Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL Page Breaks using GROUP BY

Status
Not open for further replies.

cmayo

MIS
Apr 23, 2001
159
US
Does MySQL support using the GROUP BY clause or any other mechanism to insert page or section breaks in query outputs? I'm trying to turn something like this:

[tt]+--------------------------------------------------+------------------+
| name | type |
+--------------------------------------------------+------------------+
| Dallas National, Dallas | 18-hole Private |
| Colonial Country Club, Fort Worth | 18-hole Private |
| Brook Hollow Golf Club, Dallas | 18-hole Private |
| Crown Colony Country Club, Lufkin | 18-hole Public |
| Tour 18, Flower Mound | 18-hole Public |
| Squaw Valley, Comanche Lakes, Glen Rose | 18-hole Public |
| Starr Hollow, Tolar | 9-hole Courses |
| Magnolia Ridge CC, Liberty | 9-hole Courses |
| Stewart Peninsula, The Colony | 9-hole Courses |
+--------------------------------------------------+------------------+[/tt]

Into something like this:

[tt]+------------------------------------------+
|18-hole Private |
+------------------------------------------+
|Dallas National, Dallas |
|Colonial Country Club, Fort Worth |
|Brook Hollow Golf Club, Dallas |
+------------------------------------------+

+------------------------------------------+
|18-hole Public |
+------------------------------------------+
|Crown Colony Country Club, Lufkin |
|Tour 18, Flower Mound |
|Squaw Valley, Comanche Lakes, Glen Rose |
+------------------------------------------+

+------------------------------------------+
|9-hole Courses |
+------------------------------------------+
|Starr Hollow, Tolar |
|Magnolia Ridge CC, Liberty |
|Stewart Peninsula, The Colony |
+------------------------------------------+[/tt]

Without having to use a procedural language.

Help?

Tia.
 
I think what you are asking for is output formatting. The answer is probably no. MySQL's engineering methodology appears to be to keep MySQL as simple as possible by not adding anything to the server that does not deal with manipulation of data.

MySQL does have a GROUP BY function. But what you will get from a query like:

select * from golf group by description, course

is

Code:
+-----------------------------------------+-----------------+
| course                                  | description     |
+-----------------------------------------+-----------------+
| Brook Hollow Golf Club, Dallas          | 18-hole Private |
| Colonial Country Club, Fort Worth       | 18-hole Private |
| Dallas National, Dallas                 | 18-hole Private |
| Crown Colony Country Club, Lufkin       | 18-hole Public  |
| Squaw Valley, Comanche Lakes, Glen Rose | 18-hole Public  |
| Tour 18, Flower Mound                   | 18-hole Public  |
| Magnolia Ridge CC, Liberty              | 9-hole Courses  |
| Starr Hollow, Tolar                     | 9-hole Courses  |
| Stewart Peninsula, The Colony           | 9-hole Courses  |
+-----------------------------------------+-----------------+

Want the best answers? Ask the best questions: TANSTAAFL!
 
::sigh::

I fear you are correct, the topic just seems not to exist. Ah well, a simple enough matter in PHP...

Thanks for the quick reply.
 
There's a farily new browser based MySQL report generating tool called the QLR manager that produces reports, including being able to create page breaks on group, etc.... Check it out at


Seems to work pretty good from what I've seen so far in my use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top