dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

Calculate additional column and sort by it #601

Closed devoll closed 9 years ago

devoll commented 9 years ago

How I can add additional calculated column and sort by it? Example SQL:

SELECT amount, fee, (amount - fee) as profit 
FROM payments 
WHERE client_id = 10 
ORDER BY profit 
DESC LIMIT 20, 10

Thank you!

johanroyen commented 9 years ago

You could do a raw query.