Could you describe your intent in more detail? SELECT * FROM ... GROUP BY is unstable at best, so I cannot really grasp your intention. Which lookup record's
If I guess right, you might want something in the lines of: SELECT w.post_processing_info, l.is_json FROM webpage_contents w JOIN (SELECT DISTINCT is_json from lookup_tables.lookups) l USING (content_hash) WHERE content_hash = 'abc' (this might return 0-3 rows if lookup_tables contains 3 values (0,1,and NULL) for is_json) which in turn I think would optimize best if written as: SELECT DISTINCT w.content_hash, w.post_processing_info, l.is_json FROM webpage_contents w JOIN lookup_tables.lookups l USING (content_hash) WHERE content_hash = 'abc' -- Sent from: http://sqlite.1065341.n5.nabble.com/ _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users