On Mon, 08 Aug 2011 07:50:21 +0200, William Canfield
<bill.canfi...@gmx.de> wrote:

>Hi,
>I am having trouble writing a select statement. What I want to do is this:
>
>SELECT * FROM customers WHERE NOT EXISTS (SELECT * FROM orders WHERE 
>customers.id = orders.cust_id);
>
>Is this possible at all in Sqlite?

So you are looking for customers without orders.

Try:

SELECT customers.id,customers.someothercol
  FROM customers
  LEFT OUTER JOIN orders 
  ON orders.cust_id = customers.id
  WHERE orders.cust_id IS NULL;



>regards
>W. Canfield
-- 
  (  Kees Nuyt
  )
c[_]
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to