hiddentao / squel

:office: SQL query string builder for Javascript
https://hiddentao.github.io/squel
MIT License
1.57k stars 231 forks source link

Scalar values aliasing #370

Open Nosfistis opened 5 years ago

Nosfistis commented 5 years ago

At the moment while it is possible to add scalar values (e.g. SELECT 1) with .function('1'), it is not possible to alias them, which is particularly useful in cases such as unions. For example:

SELECT 1 AS priority, col FROM a UNION SELECT 2 AS priority, col FROM b;

It is not possible to get the priority column from this query at the moment.