You must Sign In to post a response.
  • Category: SQL Server

    How to generate the value as expected using sql quer yas the reference in the description

    Dear Guys,

    I am working on the task which i need to generated the data as below but i have to arrive a data as in said as expected portion of the below thread.

    if any of you has faced such issue in generating data please look into it and send me the query back.

    my output

    ID CALLS GD TIME
    3 1 300 03:23-04:55
    4 1 301 03:23-04:55
    5 1 302 03:23-04:55
    6 1 303 11:11-12:12
    1 1 151 11:11-12:12
    8 1 304 11:11-12:12
    10 1 307 11:11-12:12
    11 2 313 11:11-12:12
    13 1 314 11:11-12:12
    12 2 313 12:51-13:51
    9 1 305 12:51-13:51
    2 1 151 12:51-13:51
    7 1 303 12:51-13:51

    Expected

    ID CALLS GD TIME
    1 1 300 03:23-04:55
    2 1 301 03:23-04:55
    3 1 302 03:23-04:55
    4 0 303 03:23-04:55
    5 0 151 03:23-04:55
    6 0 304 03:23-04:55
    7 0 307 03:23-04:55
    8 0 313 03:23-04:55
    9 0 314 03:23-04:55
    11 0 305 03:23-04:55
    13
    14 0 300 11:11-12:12
    15 0 301 11:11-12:12
    16 0 302 11:11-12:12
    17 1 303 11:11-12:12
    18 1 151 11:11-12:12
    19 1 304 11:11-12:12
    20 1 307 11:11-12:12
    21 2 313 11:11-12:12
    22 1 314 11:11-12:12
    23 2 305 11:11-12:12


    Looking forward to hearing from you guys.

    Thanks
    Prem Kumar A
  • #769753
    Hi,

    You can sort the query by ID.
    Select ID, CALLS, GD, TIME from mytable order by ID

    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


  • Sign In to post your comments