Hi,

I'm sure this is a simple question, but my Google-fu has failed me. I
need to convert the following into a sqlalchemy query and I just can't
seem to get it right:

SELECT
 ACTHD.HOURTYPE,
 sum(ACTHD.HOURS),
 sum(ACTHD.AMT)
FROM  myDatabase.dbo.TableOne ACTHD INNER JOIN
      myDatabase.dbo.TableTwo HOURR ON ACTHD.HOURTYPE = HOURR.HOURTYPE
where ACTHD.CHK_DOC_NO=13880
GROUP by ACTHD.HOURTYPE

I figured out the join part from the docs:

qry = session.query(TableOne, TableTwo).filter(TableOne.HOURTYPE ==
TableTwo.HOURTYPE)

And I know you get the "sum" command from the "func" module, but how
do I combine these?

I am using SqlAlchemy 0.5.4p2, Python 2.5 on Windows XP against MS SQL
Server 2000.

Thanks!

Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to