Welcome Guest, Not a member yet? Register   Sign In
display group_by results
#2

[eluser]xwero[/eluser]
The group by in the statement compacts the group to one line so the result you get will be the last row that is fetched from the database. table:
Code:
number  name
1       me
1       I
sql statement : SELECT * FROM users GROUP BY number, outputs
Code:
number  name
1       I

You need to query the database twice, first to get the group data and then to get the group item data.

You can do it in one query if the group data is in each group item row using ORDER BY. But then your resultset can be significantly bigger and you have to do the grouping in php.


Messages In This Thread
display group_by results - by El Forum - 09-22-2008, 01:56 AM
display group_by results - by El Forum - 09-22-2008, 02:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB