Multiple result/where query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Multiple result/where query

Post by Burrito »

I've got some fields on my database as follows:

field1 - num (can be between 1 and 24)
field2 - num (can be between 1 and 60)
field3 - num (can be infinite)

as you've probably already guessed, it is time related.

I need to take a tally of field 3 for every hour (field 1). I know I could accomplish this with 24 queries, but thought there might be a way to do it with one query and just consolidate it all into a single result set.

I can use subqueries (on 4.1), so if that helps, I'm ok.

please let me know if this can be done, and if so, how?

thx,

Burrito
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I ended up just creating a for loop and looping over my query and result 24x...

it works, but I'm sure there's a better way.

Burrito
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

don't quite know what you are trying to do there..
Post Reply