Skip to content
Search

SQL:OrderBy

lastmod 2024-12-06created 2024-12-063 edits

Caveats

A column created with AS can be named with a string, but that string must not be used as-is in Order by.

At least it does not work in sqlite.

The statement below does not work.

select
       substr(ci.heat_text, 1, 2) as 'header.lane'
from charging_info as ci
order by 'header.lane'  -- 문자열을 적으면 안된다.

It must be changed as below.

select
       substr(ci.heat_text, 1, 2) as header_lane
from charging_info as ci
order by header_lane

Specifying NULL position

See also

author Zer0 sitemap