Combine two MYSQL table with same column Name -


i have 2 table

table 1 scheduletime

id    |   edition    | time   |  1     |       1      | 9:23am | 2     |       2      | 10:23am| 

table 2 actualtime

id    | edition  | time    | 1     |    1     | 10:23am | 2     |    2     | 11:23am | 

i want result

caption    | edition    | time    | scheduleed |    1       |  9:23am | actual     |    1       |  10:23am | scheduleed |    2       |  10:23am | actual     |    2       |  11:23am | 

how can in mysql ?

select  caption, edition, time         (             select  'scheduled' caption, edition, time                scheduletime             union               select  'actual' caption, edition, time                scheduletime         ) subquery order   edition, field(caption, 'scheduled', 'actual') 

output

╔═══════════╦═════════╦═════════╗ ║  caption  ║ edition ║  time   ║ ╠═══════════╬═════════╬═════════╣ ║ scheduled ║       1 ║ 9:23am  ║ ║ actual    ║       1 ║ 9:23am  ║ ║ scheduled ║       2 ║ 10:23am ║ ║ actual    ║       2 ║ 10:23am ║ ╚═══════════╩═════════╩═════════╝ 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -