Results 1 to 5 of 5
  1. #1
    akapag22 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    20

    order by case for a query

    Hi friends

    In a table the data is available in the follwing way:

    CustomerID Stage DOE



    3 stageA 06/23/2015
    1 SatgeC 06/24/2015
    2 NoStage 06/25/2015


    So Ignoring Nostages, the most recent doe is for customer id :1
    then customer iD 3 and then CustomerID: 2 (Nostages) at the end of the result

    So i want to order by results in the above fashion 1,3,2 . is this possible in access using case.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    You only have 3 ways to sort.
    customer, stage , or DOE.

    i don't see what you're doing.

  3. #3
    akapag22 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    20
    Hi ranman i want to sort by DOE but only for those records that don't have NoStage and then append the Nostage records later.

  4. #4
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    This is one option.

    Create 2 queries, 1 query does not include "NoStage" and sort DOE in descending and the 2nd query only inlcue "NoStage" and sort DOE in descending.

    Create the 3rd query to "UNION" the 2 queries above.

  5. #5
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    yes, union query.
    (your example threw me, you said 1,3,2, but you really meant 3,1,2)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 10-27-2014, 07:37 AM
  2. Case for in case field corrupt
    By Ruegen in forum Forms
    Replies: 9
    Last Post: 08-03-2014, 07:56 PM
  3. Replies: 5
    Last Post: 10-23-2012, 03:55 PM
  4. case sensitive join query
    By rbrem in forum Queries
    Replies: 5
    Last Post: 08-09-2012, 02:59 PM
  5. Pass Through Query: CASE statement
    By eww in forum Programming
    Replies: 6
    Last Post: 08-25-2011, 09:06 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums