On 16/10/2013 22:04, Igor Tandetnik wrote:
On 10/16/2013 4:49 PM, dean gwilliam wrote:
if I have two tables
1 aliases (std_name, raw_name)
2 items (name......)
what would the query look like to select all "name" fields in "itms"
that match neither "std_name" or "raw_name" in "aliases"
and where the resulting list of "name"s contains no duplicates.

select distinct name from items
where not exists (select 1 from aliases where std_name = name or raw_name = name);

Thank you very much Igor. Your answer is very much appreciated.
It seems that "std_name" would be better placed in another table eg "std_names" and I'm not sure how you'd change the query to reflect the extra table
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to