Munkhtsol Batchuluun Munkhtsol Batchuluun - 1 month ago 9
MySQL Question

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:
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.

Answer

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.