Hi, Simon,
On Wed, Mar 5, 2014 at 2:21 AM, Simon Davies <simon.james.dav...@gmail.com>wrote: > On 5 March 2014 10:04, Igor Korot <ikoro...@gmail.com> wrote: > > Hi, ALL, > > Let's say I have a table with following data: > > > > field1 field2 field3 field4 > > 1 2 3 4 > > 5 6 7 8 > > > > How do I write a query which will produce the output as: > > > > 1 2 > > 5 6 > > 3 4 > > 7 8 > > > > Is it possible to write a single query which will produce the output like > > this? > > And not just in SQLite.... > > Possibly: > select v1, v2 from ( select 1 as ordr, f1 as v1, f2 as v2 from t union > all select 2, f3, f4 from t ) order by ordr, v1; > With UNION I will have 2 DB hits, correct? Meaning I execute the part on the left side of the UNION and then execute the right side of the UNION and then add the results together. Do I understand correctly? Thank you. > > > > > Thank you. > > Regards, > Simon > _______________________________________________ > 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