467,883 Members | 1,245 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,883 developers. It's quick & easy.

Is this the right way to go about ranking things?

Haven't had much experience with the various OLAP functions in DB2, but
want to work out what the best performing products were yesterday, by
category and by location. Is this the most efficient way to go about

[for this example, transactions is a summary of sales including
location, category, productcode, transdate and (count of) bookings in

select category, location, productcode, bookings
SELECT category,
s.productcode, t.bookings,
dense_rank() over (partition by s.category, s.destination order by
bookings desc) as ranked_bookings
FROM transactions WHERE transdate = current date - 1 days

) as a
WHERE ranked_bookings = 1

Mar 22 '06 #1
  • viewed: 878

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Petre Huile | last post: by
1 post views Thread by Joseph Bloch | last post: by
5 posts views Thread by valglad | last post: by
5 posts views Thread by Chris | last post: by
reply views Thread by debasisdas | last post: by
1 post views Thread by Paulo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.