On 2016/04/05 11:48 AM, Niall O'Reilly wrote:
> On 5 Apr 2016, at 10:06, Graham Holden wrote:
>
>> Change "select abs(num)" in your second example to "select num" and 
>> you should be good. I'm guessing in your first example the ORDER BY 
>> only applies to the last SELECT.
>
>   I expect you're right, but https://www.sqlite.org/lang_select.html 
> seems to suggest
>   that ORDER BY covers the entire compound SELECT.
>
>   I wonder whether this is a documentation bug or just me.

The documentation is correct and the fault is not that the ORDER BY did 
not only apply to the last select - the problem is more that the ORDER 
BY abs(num) did not know that "num" is a valid column name in the 
compound select - which seems understandable, and perhaps not a bug, but 
probably something that can be fixed or enhanced.


Reply via email to