KevySaysBeNice
[H]ard|Gawd
- Joined
- Dec 7, 2001
- Messages
- 1,452
Hi all!
I've got a potentially large data set that I'm trying to work with, and I'm trying to figure out the best/most efficient way of getting data out of a DB. Here is a simplified example:
In this example, I might have done something like:
My GOAL, is to order by time, BUT return all of the "person" values together. So, I'd LIKE to return something like this:
Does this make sense? So something like
(note I made up the "STICK THESE THINGS TOGETHER NO MATTER WHAT" bit
)
Thanks for any help!!!
EDIT: And for anybody that cares, the reason I care about this is because I want to get the latest data out first, and if I know the data is in the correct order coming out of the DB then I can iterate through the data (each "person" ID represents an object that I'm building as I iterate through) once and know I have everything. So if I want to get the latest updates for 3 people, I can return all of the data, then iterate through the data and move onto the next object once the "person" ID changes.
I've got a potentially large data set that I'm trying to work with, and I'm trying to figure out the best/most efficient way of getting data out of a DB. Here is a simplified example:
Code:
PERSON TIME
-------------------------
2 8:00
1 9:30
1 9:45
2 10:45
2 11:00
1 11:30
In this example, I might have done something like:
Code:
SELECT person, time FROM table ORDER BY time
My GOAL, is to order by time, BUT return all of the "person" values together. So, I'd LIKE to return something like this:
Code:
PERSON TIME
-------------------------
2 8:00
2 10:45
2 11:00
1 9:30
1 9:45
1 11:30
Does this make sense? So something like
Code:
SELECT person, time FROM table order by TIME, STICK THESE THINGS TOGETHER NO MATTER WHAT person
Thanks for any help!!!
EDIT: And for anybody that cares, the reason I care about this is because I want to get the latest data out first, and if I know the data is in the correct order coming out of the DB then I can iterate through the data (each "person" ID represents an object that I'm building as I iterate through) once and know I have everything. So if I want to get the latest updates for 3 people, I can return all of the data, then iterate through the data and move onto the next object once the "person" ID changes.
Last edited: