chet139 Posted April 3, 2008 Share Posted April 3, 2008 Hi, I want to be able to select the rows from the customer table - but only those customers who are not in the order table..... Any ideas I tried these but obviously does not work: select * from customer where customer.custId NOT in furniture.order.custId select * from customer where customer.custId NOT = furniture.order.custId Any suggestions. Thank You Quote Link to comment https://forums.phpfreaks.com/topic/99332-solved-selecting-those-rows-which-are-not-in-another-table/ Share on other sites More sharing options...
chet139 Posted April 3, 2008 Author Share Posted April 3, 2008 SOLVED. Can close this topic if required. select * from customer where customer.custId NOT in (select furniture.order.custId from furniture.order) Quote Link to comment https://forums.phpfreaks.com/topic/99332-solved-selecting-those-rows-which-are-not-in-another-table/#findComment-508258 Share on other sites More sharing options...
fenway Posted April 3, 2008 Share Posted April 3, 2008 Though I'd prefer a left join. Quote Link to comment https://forums.phpfreaks.com/topic/99332-solved-selecting-those-rows-which-are-not-in-another-table/#findComment-508426 Share on other sites More sharing options...
aschk Posted April 3, 2008 Share Posted April 3, 2008 I also would prefer a LEFT JOIN to avoid issues with the whole dataset from `order` being brought back, which I can only imagine is rather large... Quote Link to comment https://forums.phpfreaks.com/topic/99332-solved-selecting-those-rows-which-are-not-in-another-table/#findComment-508540 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.