On Fri, Jan 21, 2011 at 6:53 PM, Josh Gibbs <[email protected]> wrote:

> Could someone please clarify for me if the the resulting order of a UNION
> query will come back with the left data first, then the right data in
> the case
> that no ordering has been defined for the query.
>
> My need is to have a parameter stored in a database, with an optional
> overriding parameter which should take precedence, such as:
>
> select value from param_overrides where key='setting' UNION
> select value from params where key='setting'
>
> I'd like the resulting recordset to always contain the override parameter
> first if it exists so I can simply use that value.
>
> Thanks, Josh
>

If you add a prio field (priority) to your param database, 0=highest
priority (override), 1=normal priority, you only need 1 table.  Then you can
say:

select value from params where key='setting' order by prio limit 1

Jim
--
HashBackup: easy onsite and offsite Unix backup
http://www.hashbackup.com
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to