You mean something like

select *
  from t
 where a in (select a from t where e != 1
             union
             select a from t where d > 3
             union
             SELECT a from t where c != 1 AND b != 1);

or more succinctly:

select *
  from t
 where a in (select a 
              from t 
             where e != 1
                or d > 3
                or (    c != 1
                    and b != 1));

or do you mean:

select *
  from t
 where a in (select a from t where e != 1
             intersect
             select a from t where d > 3
             intersect
             SELECT a from t where c != 1 AND b != 1);

or more succinctly:

select *
  from t
 where a in (select a 
              from t 
             where e != 1
               and d > 3
               and c != 1
               and b != 1);

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Jose Isaias Cabrera
>Sent: Wednesday, 6 February, 2019 21:22
>To: sqlite-users@mailinglists.sqlite.org
>Subject: [sqlite] Multiple SELECTs in one call
>
>
>Greetings.
>
>I need some help from you gurus to have multiple selects, but the
>sequence is important.  For example,
>
>create table t (a, b, c, d, e);
>insert into t values (1,2,3,4,5);
>insert into t values (2,2,3,4,5);
>insert into t values (3,3,3,3,3);
>insert into t values (4,1,1,1,1);
>insert into t values (5,1,1,2,2);
>insert into t values (6,2,3,2,2);
>
>what I want to do is to do a select that first chooses all items
>where e != 1, and then the result of that select be used to create
>more selects based on other criteria. For example,
>
>SELECT * from t WHERE a IN (SELECT a from t where e != 1);
>
>But I want to use the result of (SELECT a from t where e != 1); to
>run another select (SELECT a from t where d > 3); and then, one more
>select (SELECT a from t where c != 1 AND b != 1); and the final
>select would be "SELECT * from t WHERE a IN" which would have the
>result.  I hope someone understands. :-)  Thanks for the help.
>
>josé
>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to