Thanks a lot. I am going to try it tomorrow in office.
Life has an uncanny way of responding to your need.
在 "Duane Hookom email@example.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>，2016年4月12日 上午6:12写道：
Kevin,Apparently you want to find the earliest Checkin for the first 6 characters of the GroupCode and use this for sorting the group.You can use a subquery like:SELECT tblGroupBooking.CheckIn, tblGroupBooking.GroupCode,(SELECT MIN(Checkin) from tblGroupBooking GB WHERE LEFT(GB.GroupCode,6) = LEFT(tblGroupBooking.GroupCode,6)) AS GroupCheckinFROM tblGroupBooking;I don't believe you can sort by the derived column in the query but think this might work to sort a report. If that doesn't work, you could replace the subquery with DMin().Duane Hookom, MVPMS Access
Date: Tue, 12 Apr 2016 05:54:27 +0800
Subject: Re:[MS_AccessPros] Re: Order question in query.
This is the result I want:
Life has an uncanny way of responding to your need.在 "firstname.lastname@example.org [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>，2016年4月12日 上午5:26写道：
KevinI'm not understanding what you mean by "they should stick together". The sort order should still work even though the group code is a little longer.What results are you getting now and what is your query?Regards,Bill Mosca, Founder - MS_Access_Professionalshttp://www.thatlldoit.comMicrosoft Office Access MVPhttps://mvp.microsoft.com/en-us/PublicProfile/35852?fullName=Bill%20%20MoscaMy nothing-to-do-with-Access bloghttp://wrmosca.wordpress.com
---In MS_Access_Professionals@yahoogroups.com, <email@example.com> wrote :Dear All,
Is the possible to get this done by query?
I want the check in to be the first order, and BroupCode the second order. But If the group code has the same prefix (e.g. abc001), then they should stick to one another. Is that possible? Or is there's any other way to make the outcome look like this? Thanks in advance.
Posted by: zhaoliqingoffice <firstname.lastname@example.org>
|Reply via web post||•||Reply to sender||•||Reply to group||•||Start a New Topic||•||Messages in this topic (5)|