+ 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
    365
    Posts
    7,908

    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
    Office 365
    Posts
    5,057

    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 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Sorting a comma list inside a single cell
    By hintysen in forum Excel General
    Replies: 2
    Last Post: 06-15-2018, 10:29 AM
  2. Replies: 5
    Last Post: 04-16-2015, 02:26 AM
  3. Passing on Variable path to connection inside query table
    By bharatmvs in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2015, 05:11 AM
  4. VBA to modify SQL Query inside of Access
    By ericbartha in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2014, 04:08 PM
  5. Use Cell reference inside sql query command text - how?
    By azhanurul in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2012, 05:42 AM
  6. Replies: 1
    Last Post: 06-01-2011, 03:30 AM
  7. Sorting Numbers Inside a Cell
    By totallysoccer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-14-2008, 10:52 AM

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