This will work great - just a correction, there should be a comma after 
"columnB" in the order by clause, else it might not parse, so the 
revised is:

SELECT * FROM table
          ORDER BY columnA, columnB,
          CASE WHEN columnC = 1
          THEN 0 ELSE 1 END;



On 2015-08-22 10:47 PM, Kevin Benson wrote:
> On Sat, Aug 22, 2015
>
>> afriendandmore wrote:
>>> The table shall be ordered according to A. (Order by A)
>>> But if C ist true and to the value B1 in this Record, there exists
>> another Record with B2 and B2 = B1, then B1 should be ordered in the row
>> above B2.
>
> If the B1 and B2, to which you refer, are just two equal values in
> different rows of column B, then it sounds like you want:
>
> SELECT * FROM table
>           ORDER BY columnA, columnB
>           CASE WHEN columnC = 1
>           THEN 0 ELSE 1 END;
>
> If neither ASC or DESC are specified, rows are sorted in ascending (smaller
> values first) order by default.
> --
>     --
>        --
>           --???--
>          K e V i N
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to