Home  >  Q&A  >  body text

mysql - How to connect two select results in sql statement?

As shown in the figure, these two results are obtained from select queries. How to join them and merge them?

滿天的星座滿天的星座2703 days ago840

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-25 15:10:05

    UNION

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-25 15:10:05

    The union fields must be the same. You can add a field (number of people entering the site) to the result of the first picture as 0. The
    sql statement is as follows (select time_start, time_end,0 as num from table) union
    (select time_start, time_end, num from table );
    num refers to the number of people entering the station

    reply
    0
  • Cancelreply