Problems? Is your data what you think it is? | |
PerlMonks |
mysql sortingby sulfericacid (Deacon) |
on Jun 01, 2005 at 05:57 UTC ( [id://462305]=perlquestion: print w/replies, xml ) | Need Help?? |
sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
This was asked in the CB but thought the answers would be easier through here. You have a mysql database with a column "group". Group can contain nothing, unique values OR shared values with other similar rows of data within the same group. How would you fetch all of the rows, sort them by the group column and THEN print a header of the group name for each unique group name? For example, the "group" from above would print out: The rows should be sorted by "group". Then each "group" has their own header (header would be a prinout of the group itself) which prints before the sql results. Groups are dynamic so it can't be hard coded.
My idea: It seems like this could work but if there's some odd hundred of unique groups, the overhead of all those queries is probably too pricey. Any ideas or suggestions? "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us" sulfericacid
Back to
Seekers of Perl Wisdom
|
|