Jump to content

[SOLVED] query problem...


rsammy

Recommended Posts

i have this query...

 

SELECT DISTINCT appt_pat_id, appt_loc as admit_visit_loc, '' as admit_room_no
FROM appt_schd
WHERE admit_visit_loc='Good Sam' AND appt_date ='2007-06-29' 
UNION
SELECT admit_pat_id as appt_pat_id, admit_visit_loc, admit_room_no
FROM admit_stat
WHERE admit_visit_loc = 'Good Sam'

 

whats wrong with this code? when i try executing this, it says 'unknown field admit_visit_loc in 'where clause'. this, it says for the first query. if i change that field name to appt_loc, it seems to be working but, it does not return all the records.

Link to comment
Share on other sites

the query, when i test it in MYSQLFront(a database interface) works fine - it results 11 results(one from appt_schd table for the day and 10 from admit_stat table). but, when i run this query in PHP, it returns just 2 records(from admit_stat table). any reason or idea why it behaves different here?

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.