Skip to content
Advertisement

sql query to select records from mysql

Can suggest me the best way to select records from MySQL

I need to select bed which are vacated or not allotted

Here, the expected results are The empty bed should be: bed_id’s = 2 and 3 what is best SQL query to get this kind of result

Advertisement

Answer

Join the tables and group by the bed’s id and put the conditions in a HAVING clause:

I’m not sure if you need and or or in the conditions

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement