-1

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: enter image description here There is input form. From that form get into tables. enter image description here 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/ enter image description here By ReDesign my DB. How to do this please help me. Sorry My english is bad.
  • You are not clear. Please give input & output table definitions, example input table data and its example output table data. (Why are you showing the forms?? Are `id` etc *columns* or are they *values in a `Types` column*? The three tables each have a unique `niit_duudlaga_...` column. How do they affect the output? Does the output have one column `niit_duudlaga`? Your input and output data should show these columns. Why not just `UNION` the tables and `SELECT call_center_telephone.niit_duudlaga_telephone AS niit_duudlaga`? – philipxy Oct 24 '16 at 04:14

2 Answers2

0
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 
0

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.

Vish
  • 16
  • 3