+ Reply to Thread
Results 1 to 3 of 3

Sorting inside a Query

  1. #1
    Registered User
    Join Date
    02-27-2018
    Location
    Michigan, United States
    MS-Off Ver
    2016 Excel
    Posts
    19

    Sorting inside a Query

    I am suppose to show the following fields in the order of - "actor role", "person_id", "actor first name", "actor last name", "death state", "cause of death", and "date of death". Then I have to sort first by death state (ascending), then by death cause (ascending), then by person id (ascending). My question is how do I sort by person id without changing the order of of the fields? I have already sorted by death state and death cause but do I have to add in another person id field?
    Attached Images Attached Images

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    2013 / 2016
    Posts
    4,875

    Re: Sorting inside a Query

    Take off the sorts on the wizard. Go to the SQL View. Make sure you get rid of the trailing semicolon and add a line of SQL:
    Please Login or Register  to view this content.
    The columns will come out in the order specified in the wizard, but be sorted by column 6 first and column 5 next. When you return to the wizard, you will see that these columns are added to the definition in that order, sorted, but not shown
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    3,479

    Re: Sorting inside a Query

    as dflak posted you can fix it in the sql... your other option is to add the columns in the order you want them to sort in (i mean add them to the query a second time).... and un-click the "show", but select sort (ascending or descending), then it will sort by those but not show them, and output in your original order.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1