SELECT prop_value FROM Table1 WHERE obj_id=10 AND prop_key='key1' AND
(prop_tag='ios' OR prop_tag='*') ORDER BY prop_tag == 'ios' DESC LIMIT 1;
You want to order by prop_tag == 'ios' in DESCENDING order. That is, the true
(1) before the false (0). The default ascending sort will sort the
On 29 Feb 2020, at 8:37am, Marco Bambini wrote:
> ORDER BY (prop_tag='ios') LIMIT 1;
>
> I would like to prioritise results based on the fact that the prop_tag column
> is 'ios'.
SQLite has a conditional construction:
CASE prop_tag WHEN 'ios' THEN 0 ELSE 1 END
So do
SELECT …
ORDER BY
Hi all,
Is there a way to specify an ORDER BY clause by column value?
I have a table declared as:
CREATE TABLE Table1 (id INTEGER PRIMARY KEY AUTOINCREMENT, obj_id INTEGER,
prop_key TEXT, prop_value TEXT, prop_tag TEXT DEFAULT '*', UNIQUE(obj_id,
prop_key, prop_tag))
and a sample query:
3 matches
Mail list logo