_confused_ Posted October 14, 2005 Share Posted October 14, 2005 help! how to i reference a record from master table when it doesn't have a child record? below is a sample i got from the postgreSQL manual & my problem is rather similar to that. how should i write my sql query so that CAT will also appear but the vegetable column for it is empty? i've tried using MS Access and the records retrieved is correct. The sql query goes like this: SELECT animal.animal_id, vegetable.* FROM animal LEFT JOIN vegetable ON animal.animal_id = vegetable.animal_id; test=> SELECT * FROM animal; animal_id | name -----------+----------------- 507 | rabbit 508 | cat (2 rows) test=> SELECT * FROM vegetable; animal_id | name -----------+----------------- 507 | lettuce 507 | carrot 507 | nut (3 rows) test=> SELECT * test-> FROM animal, vegetable test-> WHERE animal.animal_id = vegetable.animal_id; animal_id | name | animal_id | name -----------+-----------------+-----------+----------------- 507 | rabbit | 507 | lettuce 507 | rabbit | 507 | carrot 507 | rabbit | 507 | nut (3 rows) Quote Link to comment https://forums.phpfreaks.com/topic/2660-master-slave-table-problem/ Share on other sites More sharing options...
_confused_ Posted October 14, 2005 Author Share Posted October 14, 2005 i'm running PostgreSQL 7.0.3 and my query using left join gives me this error message. does this mean all hope is gone?? PostgreSQL said: ERROR: OUTER JOIN is not yet supported Quote Link to comment https://forums.phpfreaks.com/topic/2660-master-slave-table-problem/#findComment-8831 Share on other sites More sharing options...
_confused_ Posted October 14, 2005 Author Share Posted October 14, 2005 pheww! i've used two sql queries to grab the records separately from both tables and then play around with condition statements...it works perfectly. Quote Link to comment https://forums.phpfreaks.com/topic/2660-master-slave-table-problem/#findComment-8833 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.