Hi,
Thanks for the reply (and sorry for my late response!).
I am indeed on a 0.7 build. Could you go into a little more detail about
how correlate is used? The documentation for that method seems a little
vague to me.
Thanks!
On Friday, January 25, 2013 1:03:00 AM UTC-5, Michael Bayer wrote:
to use your own example:
lastPostQ =
s.query(db.Post.ID).filter(db.Post.ThreadID==db.Thread.ID).correlate(Thread).order_by(desc(db.Post.Date)).limit(1).label(LastPost)
q = s.query(
db.Thread.ForumID,
lastPostQ
).\
join(db.Forum, db.Forum.ID==db.Thread.ForumID).\
Hi all,
I am trying to run a query like this one, using sqlalchemy:
SELECT
t.`ForumID`,
( SELECT `ID` FROM `posts` p WHERE `ThreadID` = t.`ID` ORDER BY p.`Date`
DESC LIMIT 1 ) as `LastPost`
FROM `threads` t
WHERE t.`Deleted` = 0
I am unsure how to achieve the subquery that comes out as
On Jan 24, 2013, at 11:03 PM, Dave Pedu wrote:
Hi all,
I am trying to run a query like this one, using sqlalchemy:
SELECT
t.`ForumID`,
( SELECT `ID` FROM `posts` p WHERE `ThreadID` = t.`ID` ORDER BY
p.`Date` DESC LIMIT 1 ) as `LastPost`
FROM `threads` t
WHERE