When I have a more complex condition / SELECT clause, I usually just use a
literal:
DB[:prod].select("name, COUNT(rev)=0 AS leaf".lit)
That's the only way I know of to do it.
Bye!
François
Le 2012-10-01 à 18:05, Christian MICHON a écrit :
> Hi,
>
> as I'm currently refactoring some of my complex jdbc prepared
> statements to a more generic ORM approach, using pure Sequel, I found
> it very difficult to translate such SQL query:
>
> SELECT NAME, COUNT(REV)=0 AS LEAF FROM PROD
>
> I cannot pass the stage beyond count. So far, I'm stuck now with:
>
> DB[:prod].select{[:name,count(:rev).as(:leaf)]}.sql
> => "SELECT NAME, count(REV) AS LEAF FROM PROD"
>
> I could not find how to code the boolean test (equal to 0). Can
> someone with experience on using count+test+aliasing help me?
>
> Thanks in advance.
>
> --
> Christian
>
> --
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sequel-talk?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.