Order by Date column

  • Hi,

    I have query to execute the output.

    It should be sorted with date also, but its sorting with only Seq_no.

    PFA - for more details

    please help me on this.

  • This was removed by the editor as SPAM

  • No still doesnt work, its happening based on seq_no only.

    PFA

  • This was removed by the editor as SPAM

  • tonyarp05 61903 (11/14/2012)


    Hi,

    I have query to execute the output.

    It should be sorted with date also, but its sorting with only Seq_no.

    PFA - for more details

    please help me on this.

    I agree with what Stewart posted. You're missing some date data. Do you want that filled in? If so, what order do you wannt the dates to "smear" down in? By Seq-No???

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • In addition, please take the time to read and following the instructions in the first article I have referenced below in my signature block regarding asking for help.

    We really need the DDL (CREATE TABLE statement) for the table(s) involved, sample data (as a series of INSERT INTO statements) for each table, the expected results based on the sample data, and most importantly your code you are using now.

    Beyond that, all you are going to get based on an image is guess work, and my crystal ball hasn't worked in years.

  • tonyarp05 61903 (11/14/2012)


    No still doesnt work, its happening based on seq_no only.

    PFA

    The output appears to be sorting exactly as specified. It's ordered first by SeqNum and then within each group of SeqNum they are ordered by Date (some of which appear to be blank or null).

    Another option is to look up some articles on using the ROW_NUMBER() operator for creating nested ordering. That operator can let you do just about any grouping/sorting you want by creating "sort" columns for as many levels or groups you need. This method can be a bit complex, but if you give us some data examples and the desired output then perhaps one of us can give you specific examples to get your desired result.

     

Viewing 7 posts - 1 through 6 (of 6 total)

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