The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
understanding "GROUP BY"
I've got 32 world cup teams separated in 8 groups of 4
I am trying to display them by group But the below query returns only the last group. When I remove the GROUP BY clause, they all display PHP Code:
I am really stucked. Can someone please give me a hint on how to proceed? I managed the Group By clause to display how I wanted. However, while there is more than one element per group (in that case it should be four), it displays only one. It consists of 8 groups with 4 teams each. I was hoping to be able to display all in same group together. I tried GROUP_CONCAT but that gives me an error. |
#2
|
|||
|
|||
GROUP BY is kind of a misnomer. It'll group your results, but not in a fashion that is useful outside of finding sums or average. What you're looking for is a complex ORDER BY I think.
Try changing your order clause to Code:
ORDER BY `groupname`,`name` Maybe I didn't get what you're trying to do, but I tried to do a lot of stuff like this before and you really can't with a single group by query. |
#3
|
|||
|
|||
I got around it by displaying one group per page.
|
#4
|
|||
|
|||
Your code needs to detect when the group changes since you're doing a per team call. You could call each of your groups, then call each team associated with it, but that's more queries.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|