Outer join question - Pl help

  • Ray K (1/26/2010)


    I'm messing around with utilizations of MAX and SELECT TOP 1, but so far, no dice. I'll keep playing with this, but again, if any of you with more knowledge than me has any ideas . . .

    It's easy to get confused. You want the record with the max date less than or equal to the test date; but it's not the date from the record that you want, it's the rate, so you can't just select the max date. I've done this before. Some day I'll remember how I did it.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Gents,

    Many thanks for all your answers. I'll implement both strategies (row_number() & CTE) and let you know how it did.

    K

  • Venkata, unless I am missing the boat on this one, I recently blogged about a similar scenario I ran into that required some date matching.

    Check it out at:

    http://jasonbrimhall.info/?p=193

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 3 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic. Login to reply