How to track same day grants of grantee RRS feed

  • Question

  • Hi,

    I am tasked to track grantee that has closed their grant and get a new one in same day. Example below show that grantee_Code 17767 has closed thier grant and get new one on the same day.

    How could I construct the select query to do that?

    Grantee_Code Grant_Issue_Date Grant_Status Grant_Amount
    17766 21/01/2019 Active "$1,234.00"
    17767 01/02/2019 Close "$2,334.00"
    17768 11/02/2019 Active "$4,232.00"
    17769 21/01/2019 Active "$42,334.00"
    17767 01/02/2019 Active "$4,564.00"
    17771 11/02/2019 Active "$2,334.00"
    17772 21/01/2019 Active "$1,223.00"
    17773 01/02/2019 Active "$23,345.00"

    Best regards


    Tuesday, November 19, 2019 1:19 AM

All replies

  • ;with mycte as (
    select count(distinct Grant_Status) cnt, Grantee_Code,Grant_Issue_Date
    from mytable
    Group by Grantee_Code,Grant_Issue_Date
    select * from mycte
    where cnt>1

    Tuesday, November 19, 2019 2:03 AM
  • How to know that “Active” happened after “Close”?

    Tuesday, November 19, 2019 6:46 AM
  • Hi SSamnang,

    Could you please share us your expected result and logic ? So that we’ll get a right direction and make some test.

    Best Regards,

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, November 20, 2019 7:09 AM