I have got below format using join query
status | vacancy | selected
opening| 10 | 5
closed | 10 | 2
but I want to below format, how to get it using 'mysql' query
status | selected
vacancy | 10
opening | 5
closed | 2
You can select the vacancy and make a union with your other select.
select 'vacancy', h.vacancy from hotel h where h.id = 1
union all
select status, selected from room where hotel_id = 1
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments