skip to main | skip to sidebar

wcleung Speaks

Promoting Positive Thinking Through Public Speaking, AND Promoting Speaking in Public Through Thinking Positively.

10 October 2006

Top-N, Rank() and Partition

To get Top-N, and rank; Can do this:


SELECT * FROM
(
SELECT b.ap_prog_code, b.dealer_code, b.no_of_outlets, b.trans_Date,
rank() OVER
(
PARTITION BY b.ap_prog_code, b.dealer_code
ORDER BY trans_Date DESC
) rank_date
FROM OUTLET b
)
WHERE rank_date = 1
Posted by wcleungspeaks at 10/10/2006 04:51:00 PM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2007 (50)
    • ►  August (1)
    • ►  July (1)
    • ►  June (9)
    • ►  May (11)
    • ►  April (4)
    • ►  March (11)
    • ►  February (3)
    • ►  January (10)
  • ▼  2006 (86)
    • ►  December (9)
    • ►  November (7)
    • ▼  October (7)
      • Advice from my Dad
      • Rich and Poor Dads
      • Mandela and Gandhi
      • Top-N, Rank() and Partition
      • Sifu will not teach ... the decipel will kill the ...
      • Make Oracle Autostart Database
      • Attended a Internet Marketing Interest Group last ...
    • ►  September (9)
    • ►  August (15)
    • ►  July (5)
    • ►  June (7)
    • ►  May (1)
    • ►  April (6)
    • ►  March (7)
    • ►  February (5)
    • ►  January (8)
  • ►  2005 (3)
    • ►  December (3)

Links

  • Enigma's Graffiti
  • BabySiew's Oyster World

About Me

wcleungspeaks
View my complete profile