Pavel Ivanov wrote:
> It mentions "from" and "column_name" where column name in this
> particular case is "selected". ;-)
>
> @Igor: I thought that sql standard in this case doesn't guarantee that
> outer select will return rows in the same order that were enforced in
> inner select by "order by", does it?

Yes, technically, I guess, the order is not guaranteed, though SQLite is 
highly likely to return records in the same order subselect generated 
them. Note that Rand Huck's temporary table solution suffers from the 
same problem.

My solution can be modified to give you that extra peace of mind:

select id,  url,  selected from (
    SELECT id,  url,  selected, name FROM db1.test  UNION
    SELECT id,  url,  selected, name FROM db2.test
    ORDER BY name ASC, id DESC LIMIT 100
)
order by name ASC, id DESC;

Of course, both are solutions in search of a problem. It is likely 
trivial to simply ignore the extra column in the host application.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to