Home Forums Data Warehousing Data Mining Need to find date of Nth crash for every car_make in every country RE: Need to find date of Nth crash for every car_make in every country

  • Matt Miller (#4) (1/16/2014)


    by the way - you will want to incorporate the event_date into the ORDER BY, otherwise the row_number() will essentially assign numbers within a group ad-hoc (i.e. not exactly "at random", but it won't always assign the numbers in the same way). So just make sure that whatever you're using the ORDER BY gives you a good enough ordering (so that if it does include multiple entries with the same ORDER BY "key", you're comfortable with any of them being the one being returned).

    To add a little bit more, the columns CarMake and Country are not needed in the ORDER BY because they're in the PARTITION BY.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2