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 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) 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. 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... 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
Archived
This topic is now archived and is closed to further replies.