Ok. Just found I gave wrong info. To make my life easier, the person who created db named cust_id in 'orders' table as SoldTo
[EMAIL PROTECTED] in this case, select cust_id from customers where cust_id not in (select Soldto from orders); will not work :( > On Fri, 20 Oct 2006, [EMAIL PROTECTED] wrote: > >> hi to all, >> I have table customers (PK cust_id) >> I have table orders (PK order_id, FK cust_id) >> >> I need query that will selecct all customers from 'customers' they don't >> have any order, there is not their cust_id in 'orders'. >> >> couls somebody help me? >> >> thanks. >> >> -afan > > I think the most explicit way is with a sub select: > > select cust_id from customers where > cust_id not in > (select cust_id from orders); > > -w > >> -- >> MySQL General Mailing List >> For list archives: http://lists.mysql.com/mysql >> To unsubscribe: >> http://lists.mysql.com/[EMAIL PROTECTED] >> >> >> > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]