Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: (Class::DBI Oracle SQL) rownum and group by woes

by socketdave (Curate)
on Jul 15, 2005 at 15:30 UTC ( [id://475250]=note: print w/replies, xml ) Need Help??


in reply to (Class::DBI Oracle SQL) rownum and group by woes

Tyraziel, try this:

select sum(t.amount) as total, a.id, t.id from accounts a, transactions t where a.id = t.id group by (a.id, t.id) having rownum < ?

Where works before 'group by' and having works after.
  • Comment on Re: (Class::DBI Oracle SQL) rownum and group by woes

Replies are listed 'Best First'.
Re^2: (Class::DBI Oracle SQL) rownum and group by woes
by Tyraziel (Novice) on Jul 15, 2005 at 17:36 UTC

    Brilliant! Simply Brilliant! That didn't even cross my mind to put that in the having clause, and great explination on how where works before group by and having works after. I did not know that :-)

    So far I've asked 2 questions here on PerlMonks and got 2 great answers!

    PerlMonks++ and socketdave++

      Glad I could help... I had to think about this one for a minute. I'm hopelessly addicted to 'limit' in MySQL.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://475250]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-26 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found