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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.