How to get descending order of concatenated field values

  • Hello Every one,

    I am working on sql server database and I'm facing a problem to get descending order of field values are concatenated.

    For Ex: My field values are having like below
    Input:

    Field value1:       10/5/2016, 20/11/2016, 1/8/2016
    Field value2:       8/2/2016, 26/4/2016
    Field value3:       22/10/2016, 6/6/2016
    Field value4:       25/12/2016, 2/2/2016, 20/10/2015, 15/7/2016

    Output required:
    Field value1:       20/11/2016, 1/8/2016, 10/5/2016
    Field value2:       26/4/2016, 8/2/2016
    Field value3:       22/10/2016, 6/6/2016
    Field value4:       25/12/2016, 15/7/2016', 2/2/2016, 20/10/2015

    Any help is appreciated.

    Thanks,
    Nagendra.

  • Please post DDL and sample data. 
    From what you posted, your input field is date type, but once you concatenate it, will lose date for the entire string.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

  • Well are you getting just the concatenated data or do you have access to the base fields, if so just sort on those in the desired order.

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

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