You cannot but you can try this: db(db.employees.salary, "CASE WHEN salary <= 2000 THEN 'PoorOne' END AS salary_level", orderby=db.employees.salary)
let us know if it works. On Nov 26, 6:53 am, Yannick <ytchatch...@gmail.com> wrote: > Hello Mate, > > I just double check in the book and the documentation resources > because I was wondering how to actually create a DAL query that > include "Case" statement ? > Like let's say I have an SQL like this : > > SELECT salary, > CASE > WHEN salary <= 2000 THEN 'PoorOne' > END AS salary_level > FROM employees > ORDER BY salary ASC > > How can I write such a query with "CASE" statement in Web2py ? > > Thanks, > Yannick P. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.