On 3/15/2011 2:29 PM, Ralf Jantschek wrote:
> I have to compare entries with status=0 to status=1 and find out the
> differences in name, value fields.
>       - are there name entries with Status=0 that are not there with
> Status=1

select * from MyTable where status = 0 and name not in (
   select name from MyTable where status = 1);

>       - are there name entries with Status=0 that have a different value
> under Status=1

select * from MyTable t1 join MyTable t2 on (t1.name = t2.name)
where t1.status = 0 and t2.status = 1 and t1.value != t2.value;

>       - are there name entries with Status=1 that are not there with
> Status=0

select * from MyTable where status = 1 and name not in (
   select name from MyTable where status = 0);

-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to