On Thu, Apr 23, 2009 at 6:01 AM, Grimsqueaker <grimsqueake...@gmail.com>wrote:

>
> I dont understand what I'm doing wrong in the following situation.
>
> If I put this:
>
> case(whens={exclude_table.c.minutes_limit != None:
> exclude_table.c.minutes_limit},  else_=5000).label
> (name='minutes_limit')
>
> in the select clause of my query, I can't say:
>
> having=(func.sum(cdr_table.c.duration) / 60) >= 'minutes_limit',
>
> later on as I get the following error:
>
> sqlalchemy.exc.DatabaseError: (DatabaseError) ORA-01722: invalid
> number
>
> I got around the problem by doing this:
>
> stupid = case(whens={exclude_table.c.minutes_limit != None:
> exclude_table.c.minutes_limit}, else_=5000).label
> (name='minutes_limit')
>

HAVING in SQL requires the full construct on all databases that I have
experience with.  So in other words you have to write HAVING COUNT(*) > 1,
and can't refer to an alias as in HAVING ticket_count > 1.
-- 
Michael Trier
http://blog.michaeltrier.com/
http://thisweekindjango.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to