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
https://forums.phpfreaks.com/topic/57793-solved-query-problem/
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
https://forums.phpfreaks.com/topic/57793-solved-query-problem/#findComment-287007
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.