... SELECT b FROM mytable WHERE b = c will give you each row of the
database which has identical b and c values.
... SELECT b FROM mytable AS m2 WHERE m2.b = m1.c will join the two views
of the database together, so if mytable contains

b,c
1,2
2,3

the combined table for this subquery looks like:
m1.b, m1.c, m2.b, m2.c
1,2,1,2
1,2,2,3
2,3,1,2
2,3,2,3

and it compares the middle two columns.

Hope this helps,
Dave.

(PS: I'm not particularly knowledgeable about SQLite, so this might well be
factually incorrect in important minor ways.)




On Tue, Dec 4, 2012 at 1:26 AM, YAN HONG YE <yanhong...@mpsa.com> wrote:

>   SELECT c FROM mytable AS m1 WHERE NOT EXISTS (SELECT b FROM mytable AS
> m2 WHERE m2.b = m1.c);
>
>   SELECT c FROM mytable WHERE NOT EXISTS (SELECT b FROM mytable  WHERE b =
> c);
>
>
>
>
> Sincerely,
> Cordialement / Best Regards / Mit freundlichen Grüßen / Cordiali saluti !
> ___________________________________________
> ---------------------------------------------------------------------------
> YE YANHONG/???- DASI/DRDS/ITVC/APFS/AVPM
> PSA PEUGEOT CITROEN(CHINA) AUTOMOTIVE TRADE CO,. LTD SHANGHAI BRANCH
> Tel: (+86) 21-2419 5488  Mobile:(+86) 13816808338  Fax: (+86) 21-2419 5004
> PSA internal call: 49 5488
> Email: yanhong...@mpsa.com<mailto:yanhong...@mpsa.com>
> Address: 6th Floor, Building 1, No. 1528, Gumei Road,
> Xuhui District, Shanghai
> Post Code:200233
> ??: ?????????1528?A1?6?
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to