SQL Query

  • I've a table having data as below -

    CodeStartDate EndDate

    SL 2011-04-04 2011-07-31

    SL 2011-04-04 2069-09-17

    VA 2011-08-01 2015-04-30

    VA 2011-08-01 2069-09-17

    VA 2015-05-01 2015-05-31

    VA 2015-05-01 2069-09-17

    SL 2015-06-01 2016-01-31

    SL 2015-06-01 2016-02-29

    SL 2015-06-01 2069-09-17

    VA 2016-02-01 2069-09-17

    VA 2016-03-01 2069-09-17

    I want to link all the sets and give an output where we have the full set of codes and I can find out which code was active at what time.

    I need out put as below -

    SL 2011-04-04 2011-07-31

    VA 2011-08-01 2015-04-30

    VA 2015-05-01 2015-05-31

    SL 2015-06-01 2016-02-29

    VA 2016-03-01 2069-09-17

    Please help.

    ____________________________________________________________

    AP
  • Not to be rude, but you should know this by now:

    http://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/

    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

Viewing 2 posts - 1 through 1 (of 1 total)

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