J
JLJones13
I have a table with several columns, two of which are
Originator (text field) and
Date (Date/Time field, format "MM/DD/YYYY HH:MM:SS")
I would like to get consecutive date ranges for each Name.
Example:
Name Start End
John 5/3/2003 5/22/2003
John 5/31/2003 6/18/2003
John 9/1/2003 9/19/2003
Kelly 4/2/2003 4/3/2003
....And so on...
Meaning that John has entries in the table for 5/3, 5/4,....5/22 and then
has entries from 5/31, 6/1... 6/18, etc.
I tried a suggestion I found on this board that was a solution to a similar
problem, but it requires an Autonumber field. I don't own these tables and
therefore I cannot add any fields to the table.
Here's my attempt. However, it only gives one entry for each person
(i.e.John with a start date of 5/3 and end date of 9/19).
SELECT
Min(R.Date) AS start,
Max(R.Date) AS end,
R.Originator
FROM dbo_V_AuditMailboxMsgsRcvd R
GROUP BY R.Originator
ORDER BY 1;
Any ideas?
Originator (text field) and
Date (Date/Time field, format "MM/DD/YYYY HH:MM:SS")
I would like to get consecutive date ranges for each Name.
Example:
Name Start End
John 5/3/2003 5/22/2003
John 5/31/2003 6/18/2003
John 9/1/2003 9/19/2003
Kelly 4/2/2003 4/3/2003
....And so on...
Meaning that John has entries in the table for 5/3, 5/4,....5/22 and then
has entries from 5/31, 6/1... 6/18, etc.
I tried a suggestion I found on this board that was a solution to a similar
problem, but it requires an Autonumber field. I don't own these tables and
therefore I cannot add any fields to the table.
Here's my attempt. However, it only gives one entry for each person
(i.e.John with a start date of 5/3 and end date of 9/19).
SELECT
Min(R.Date) AS start,
Max(R.Date) AS end,
R.Originator
FROM dbo_V_AuditMailboxMsgsRcvd R
GROUP BY R.Originator
ORDER BY 1;
Any ideas?