Jump to content

GROUP BY


jaymc

Recommended Posts

I have a table which consists of usernames along with there gender and a timestamp, e.g

 

Jamie - Male - 121123123

Sally - Female - 342342342

Amy = Female - 34535353

Derek = Male - 234342424

 

I want to pull out 5 males and 5 females in order of timestamp

 

I could easily use a GROUP BY and have 2 queries dig out the males and then females

 

However, to save resources I want to cramp this into one query

 

Any ideas how?

 

I was going to use PHP after pulling out the data to display 5 males in order of time stamp, then when the counter hits 5 ignore everything else apart from females, again until the counter hits 5

 

Is there a better way to do this?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/59991-group-by/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.