Jump to content

Recommended Posts

Why is this query returning lots of extra data? How do I fix this?

 

SELECT lobby.MRN, pt_status.PATIENT_LAST_NAME, pt_status.PATIENT_FIRST_NAME, pt_status.AGE, pt_status.SEX, pt_status.CC, pt_status.CURRENT_LOCATION, pt_status.CURRENT_STATUS, pt_status.REG_TIME FROM lobby, pt_status WHERE lobby.MRN = pt_status.MRN OR pt_status.CURRENT_STATUS = 'Ready to Triage'

 

It's returning this:

 

1259697523 Chesterfield Douglas 54 Male Chest Pain Lobby Waiting on Room 1259697523

1259701307 Weaver Linda 20 Female psycho Lobby Waiting on Room 1259701307

1259697523 Harris Tate 32 Male Head Injury ER Ready to Triage 1259710317

1259701307 Harris Tate 32 Male Head Injury ER Ready to Triage 1259710317

1259710500 Harris Tate 32 Male Head Injury ER Ready to Triage 1259710317

1259697523 Morris Will 27 Male Nausea/Vomiting Lobby Ready to Triage 1259710500

1259701307 Morris Will 27 Male Nausea/Vomiting Lobby Ready to Triage 1259710500

1259710500 Morris Will 27 Male Nausea/Vomiting Lobby Ready to Triage 1259710500

 

Link to comment
https://forums.phpfreaks.com/topic/183658-mysql-query-problem/
Share on other sites

hmmm.. what is the common column between these two tables ?

 

I've attached my db schema. The only patients that are stored in the lobby table are patients that are physically there. If we do a direct admit to room they won't be in the lobby table but their current status on the pt_status will be ready to triage.

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/183658-mysql-query-problem/#findComment-969387
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.