Jump to content

Left Join Where problem


will35010

Recommended Posts

I have a query that works fine except it won't let me limit the results.

 

Current Query:

SELECT rooms.room, visit_data.patientid, visit_data.priority, visit_data.alert1, 
visit_data.alert2, visit_data.alert3, visit_data.areaid, visit_data.doctor, visit_data.nurse, visit_data.cc,
visit_data.current_status, visit_data.reg_time FROM rooms LEFT JOIN visit_data ON rooms.room = visit_data.room AND visit_data.areaid = 'ED'

 

Both tables have an areaid (example: rooms.areaid, visit_data.areaid)

 

I only want to pull data for a specific areaid, but no matter what areaid I put in it returns the same results with all areas like the AND clause isn't even there. How do I fix my query? I tried changing and to WHERE, but then it didn't return all the results I wanted from the left table. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/226483-left-join-where-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.