Breaks in date

  • Hello!

    I need help with SQL Query where ever there are breaks in the date it should insert a record into the table.

    For example, according to the table below for the product_Code "REL03H/SECSTD" and Order_Num "100" the first row should have Begin_date = 2/9/2003 and End_Date = 2/11/2003

    And Second row should have dates as 2/12/2003 and 2/14/2003.

    So, for order_Num 100 I should insert two records and for 5 records.

    TABLE:

    Product_Code,Order_Num,Begin_Date,End_Date

    REL03H/SECSTD,100,2/9/2003 15:00,2/10/2003 15:00

    REL03H/SECSTD,100,2/10/2003 15:00,2/11/2003 15:00

    REL03H/SECSTD,100,2/12/2003 15:00,2/13/2003 15:00

    REL03H/SECSTD,100,2/13/2003 15:00,2/14/2003 15:00

    REL03H/SECSTD,104,2/6/2003 15:00,2/7/2003 15:00

    REL03H/SECSTD,104,2/7/2003 15:00,2/8/2003 15:00

    REL03H/SECSTD,104,2/9/2003 15:00,2/10/2003 15:00

    REL03H/SECSTD,104,2/10/2003 15:00,2/11/2003 15:00

    REL03H/SECSTD,104,2/15/2003 15:00,2/16/2003 15:00

    REL03H/SECSTD,104,2/16/2003 15:00,2/17/2003 15:00

    REL03H/SECSTD,104,2/17/2003 15:00,2/18/2003 15:00

    REL03H/SECSTD,104,2/28/2003 15:00,3/1/2003 15:00

    REL03H/SECSTD,104,3/3/2003 15:00,3/4/2003 15:00

    REL03H/SECSTD,104,3/4/2003 15:00,2/5/2003 15:00

    ThankYou,

    Mkumari

  • This was removed by the editor as SPAM

  • Isn't this a duplicate of

    http://www.sqlservercentral.com/forum/topic.asp?TOPIC_ID=9068&FORUM_ID=8&CAT_ID=1&Topic_Title=query+help&Forum_Title=T%2DSQL

    Far away is close at hand in the images of elsewhere.
    Anon.

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

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