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
Post a Comment