-------------------------------------------- On Fri, 2/21/14, Clemens Ladisch <clem...@ladisch.de> wrote:
Subject: Re: [sqlite] partially excluding records To: sqlite-users@sqlite.org Date: Friday, February 21, 2014, 1:38 PM David Bicking wrote: >> The complication is that if a given key has any non-C value, the C values >> are to be excluded. > First, just exclude all C values: > ... WHERE Status <> 'C' ... > If there are only C values, they are to be included. >Then do the same query again, but with the all-C keys: > ... > UNION ALL > SELECT ... > WHERE Key NOT IN (SELECT Key FROM T1 WHERE Status <> 'C') > ... Reality is that the "Key" is a combination of 3 or 4 fields. I suppose I can concatenate the fields, but that seems overly ugly. And the select and existing part of the where clause are complicated, so if I can avoid repeating all of that, I'd rather avoid doing it as a union query. But if needs must, I will go with this idea. Thanks, David _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users