简体   繁体   中英

I have three tables. I want to have one table. ReDesign my table

I got three tables:

call_center_telephone - TABLE NAME
id | sanal_gomdol | uilchilgee_lavlagaa | shine_serg_zahialga |.......| date
1  | 87           | 181                 | 10                  |.......| 2016-10-18
2  | 96           | 207                 | 21                  |.......| 2016-10-19
3  | 51           | 291                 | 19                  |.......| 2016-10-20
4  | 79           | 176                 | 13                  |.......| 2016-10-21

call_center_adsl - TABLE NAME
id | sanal_gomdol | uilchilgee_lavlagaa | shine_serg_zahialga |.......| date
1  | 64           | 264                 | 2                   |.......| 2016-10-18
2  | 79           | 301                 | 7                   |.......| 2016-10-19
3  | 53           | 197                 | 3                   |.......| 2016-10-20
4  | 37           | 239                 | 5                   |.......| 2016-10-21

call_center_catv - TABLE NAME
id | sanal_gomdol | uilchilgee_lavlagaa | shine_serg_zahialga |.......| date
1  | 8            | 3                   | 11                  |.......| 2016-10-18
2  | 1            | 9                   | 27                  |.......| 2016-10-19
3  | 9            | 12                  | 19                  |.......| 2016-10-20
4  | 5            | 22                  | 33                  |.......| 2016-10-21

Here is my DB diagram: 在此处输入图片说明 There is input form. From that form get into tables. 在此处输入图片说明 I want to have one table like that

call_center - TABLE NAME
id | sanal_gomdol | uilchilgee_lavlagaa | shine_serg_zahialga |.......| date
with 3 outputs from all column like that. /date is unique/ 在此处输入图片说明 By ReDesign my DB. How to do this please help me. Sorry My english is bad.

select  top 2 *
into    new_table_name 

from    call_center_telephone

union all 
select  top 2 *
from    call_center_adsl 

union all

select  *
from    call_center_catv 

Create your_new_tableName

(Column1 Datatype...Column n Datatype)

Go;

Insert your_new_tableName

FROM

( Select * from call_center_telephone

UNION ALL

Select * from call_center_adsl

UNION ALL

Select * from call_center_catv )

Go;

Between if you want to preserve all three tables and want to merge them only for the sake of displaying it , you can think of having a view or temporary table , which combines all the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM