SQL query

  • I have input below format:

    TO_DateFROM_SMTO_SMFROM_BMTO_BMCSC_CODE

    2011-04-09 00:00:00.0000000Muneer HussainAnwar BashaM S RamaM S RamaR16001

    2011-06-06 00:00:00.0000000NULLDayakar VM S RamaRamapriyan MukunthanR16001

    2011-09-22 00:00:00.0000000Dayakar VMuneer HussainRamapriyan MukunthanRamapriyan MukunthanR16001

    2011-10-27 00:00:00.0000000Muneer HussainAnwar BashaRamapriyan MukunthanRamapriyan MukunthanR16001

    --------------

    OUT PUT

    From_DateTo_DateSMBM

    2011-04-01 00:00:00.00000002011-04-08 00:00:00.0000000Muneer HussainM S Rama

    2011-04-09 00:00:00.00000002011-06-05 00:00:00.0000000Anwar BashaM S Rama

    2011-06-06 00:00:00.00000002011-09-21 00:00:00.0000000Dayakar VRamapriyan Mukunthan

    2011-09-22 00:00:00.00000002011-10-26 00:00:00.0000000Muneer HussainRamapriyan Mukunthan

    2011-10-27 00:00:00.00000002011-12-28 00:00:00.0000000Anwar BashaRamapriyan Mukunthan

  • i don't get exactly what you are try to get here. please elaborate additionally please give same data with create and insert script to get quicker result.see my signature below

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • CREATE TABLE Master_Data

    (TO_Date DATE,FROM_SM VARCHAR(100),TO_SM VARCHAR(200),FROM_BM VARCHAR(500),TO_BM VARCHAR(200),CSC_CODE VARCHAR(100))

    insert into Master_Data values('2011-04-09 00:00:00.0000000','Muneer Hussain','Anwar Basha','M S Rama','M S Rama','R16001')

    insert into Master_Data values('2011-06-06 00:00:00.0000000','NULL','Dayakar V','M S Rama','Ramapriyan Mukunthan','R16001')

    insert into Master_Data values('2011-09-22 00:00:00.0000000','Dayakar V','Muneer Hussain','Ramapriyan Mukunthan','Ramapriyan Mukunthan','R16001')

    insert into Master_Data values('2011-10-27 00:00:00.0000000','Muneer Hussain','Anwar Basha','Ramapriyan Mukunthan','Ramapriyan Mukunthan','R16001')

  • your required/expected output ?

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • From_Date To_Date SM BM

    2011-04-01 00:00:00.0000000 2011-04-08 00:00:00.0000000 Muneer Hussain M S Rama

    2011-04-09 00:00:00.0000000 2011-06-05 00:00:00.0000000 Anwar Basha M S Rama

    2011-06-06 00:00:00.0000000 2011-09-21 00:00:00.0000000 Dayakar V Ramapriyan Mukunthan

    2011-09-22 00:00:00.0000000 2011-10-26 00:00:00.0000000 Muneer Hussain Ramapriyan Mukunthan

    2011-10-27 00:00:00.0000000 2011-12-28 00:00:00.0000000 Anwar Basha Ramapriyan Mukunthan

Viewing 5 posts - 1 through 4 (of 4 total)

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