473,395 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Grouping in a Query? Kind of an Odd Sort Problem

I have a table with names and a linked table with start and end dates for activities
They want a report (which I am exporting to excel) listed by the earliest end date for an activity. I can create a query that lists names alphabetical and then all of the activities for that person by earliest end date. But they also want the list not in alphabetical order but in order of the earliest end date of all activies for that person.
There are multiple activity records and therefore multiple enddates for each person

Example Anderson End Dates 2/15/10, 3/12/10, 1/14/10
Frank End Dates 2/10/20
Jones End Dates 1/12/10, 4/15/10

Creates List

Jones
1/12/10
4/15/10

Anderson
1/14/10
2/15/10
3/12/10

Frank
2/10/20

I'm not sure how to get the names in order of the earliest start in their list of activities.
Apr 4 '10 #1
1 1145
Delerna
1,134 Expert 1GB
Not sure I understand you correctly ... but
You could prepend the persons name with the min([End Date])

Expand|Select|Wrap|Line Numbers
  1. select min([End Date]) & Name as Nme,[End Date]
  2. From theTable
  3. Join theOherTable join conditions
  4. group by Name,[End Date]
  5. order by Nme
  6.  
or perhaps more simply
Expand|Select|Wrap|Line Numbers
  1. select min([End Date]) as Dte, Name,[End Date]
  2. From theTable
  3. Join theOherTable join conditions
  4. group by Name,[End Date]
  5. order by Dte,Nme
  6.  
Apr 6 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Debbie Davis | last post by:
Hi there, SQL 2000 I have the following query: SELECT sponsor, COUNT(sponsor) * 2 AS total FROM Referrals GROUP BY sponsor Works great, returns the sponsor and the total * 2 of their...
5
by: Mike King | last post by:
I don't know how to group the following data in the way I want it. I want the output of the transformation to be "5678". Does anyone know what I am doing worry? <?xml version="1.0"?> <data>...
0
by: Stephen | last post by:
I have the following xslt and I am trying to use two levels of grouping. I am first grouping on the report category, then on the report type. The problem is I am sure I have to apply some sort of...
3
by: Miguelito Bain | last post by:
hi- i have a simple table. i have 3 fields, id, indate, and outdate. i want to group these fields in my report by month. for example, for february 2004, i want to display all the ids and dates...
3
by: ahaque38 | last post by:
Hello. Using A2K SP3, I am having the following problem with a report using "Sorting and Grouping". I have recently added a grouping in the reports for "Category2<>'CONTRACTS'". I have...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
3
by: Jimmy Tran | last post by:
Hello everyone, I have a table with many columns. Two of them are VehicleNumber and ShipDate. What I would like to do is sort all the data in ascending date(ShipDate) but I also like to group...
6
by: craig.buchinski | last post by:
Ok, i have a Access Database (which is used with my ESRI Arcmap) and i have written a query for a report to pull out our streetlights and group them by billing wattage. The problem is that it is...
3
by: Jimmy | last post by:
Is there a way to sort/group a report based on the second column of a combo box, i.e. the text associated with the primary key number?
2
by: dez5000 | last post by:
I have a query that is pulling a list of patients seen within a certain time frame at certain locations and it also shows whether they had a certain test done. I want to report by location the list...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.