Thanks for the note Massimo,
I did test what you suggested, but it's not working with no error or
ticket generated ... I print the generated SQL query and it looks
fine... I think DAL doesn't handle "Case"...
Thanks anyway I'll used a work around solution...

Cheers,
Yannick P.

On Nov 26, 8:27 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> 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.


Reply via email to