LEADing Rows

  • Comments posted to this topic are about the item LEADing Rows

  • Stewart "Arturius" Campbell (9/21/2015)


    Nice question, thanks Steve

    Lead and Lag are really handy operators, especially for trend analysis on relational data...

    +1

    Thanks for sharing Steve.

  • Stewart "Arturius" Campbell (9/21/2015)


    Nice question, thanks Steve

    Lead and Lag are really handy operators, especially for trend analysis on relational data...

    +1.

    Easy point. 🙂 Thanks for sharing.

  • Even though I know what LEAD does, I still got it wrong because for some reason I was thinking from "right to left". Moar caffeine!

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Wow - got one right that Koen got wrong!

  • Koen Verbeeck (9/22/2015)


    Even though I know what LEAD does, I still got it wrong because for some reason I was thinking from "right to left". Moar caffeine!

    We all make mistakes, especially when not caffeinated enough.

  • paul s-306273 (9/22/2015)


    Wow - got one right that Koen got wrong!

    I was correct in my head. I only selected the wrong answer 😀 😛 😎

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (9/22/2015)


    Even though I know what LEAD does, I still got it wrong because for some reason I was thinking from "right to left". Moar caffeine!

    LAG and LEAD always trip me up, because I forget what is LAGging and what is LEADing.

    (Really, no pun about a LEADing question yet? I'm slightly disappointed.) 😛

  • sknox (9/22/2015)


    Koen Verbeeck (9/22/2015)


    Even though I know what LEAD does, I still got it wrong because for some reason I was thinking from "right to left". Moar caffeine!

    LAG and LEAD always trip me up, because I forget what is LAGging and what is LEADing.

    (Really, no pun about a LEADing question yet? I'm slightly disappointed.) 😛

    Sorry, I'm lagging behind on replying on the QoTD topics.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • paul s-306273 (9/22/2015)


    Wow - got one right that Koen got wrong!

    Miracles do happen 😀 🙂 😉

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • sknox (9/22/2015)


    Koen Verbeeck (9/22/2015)


    Even though I know what LEAD does, I still got it wrong because for some reason I was thinking from "right to left". Moar caffeine!

    LAG and LEAD always trip me up, because I forget what is LAGging and what is LEADing.

    Now I will never confuse between them again 😉

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Thanks for the question. Of course I can't use these because we are still on 2008.

  • Iwas Bornready (9/22/2015)


    Thanks for the question. Of course I can't use these because we are still on 2008.

    My condolences

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • sknox (9/22/2015)


    Koen Verbeeck (9/22/2015)


    Even though I know what LEAD does, I still got it wrong because for some reason I was thinking from "right to left". Moar caffeine!

    LAG and LEAD always trip me up, because I forget what is LAGging and what is LEADing.

    (Really, no pun about a LEADing question yet? I'm slightly disappointed.) 😛

    I agree. I tend to think of LAG as my row is lagging what I'm looking at ahead, but it's the reverse.

  • Steve Jones - SSC Editor (9/22/2015)


    sknox (9/22/2015)


    Koen Verbeeck (9/22/2015)


    Even though I know what LEAD does, I still got it wrong because for some reason I was thinking from "right to left". Moar caffeine!

    LAG and LEAD always trip me up, because I forget what is LAGging and what is LEADing.

    (Really, no pun about a LEADing question yet? I'm slightly disappointed.) 😛

    I agree. I tend to think of LAG as my row is lagging what I'm looking at ahead, but it's the reverse.

    I think of it in terms of where the value is returned. When you select a column, the value being displayed is returned in a row. The LAG refers to the row(s) that LAGs behind the current row and the LEAD refers to the row(s) that LEAD it. I sometimes get tripped up by leading versus lagging indicators, but if I try to remember that the data is returned in a row, it gives me the base row from which to think.

    I know...thinking in rows = :sick:, but this is the best way I've found to keep track of this particular thing.

Viewing 15 posts - 1 through 15 (of 23 total)

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