Re: Optimize Query Output
| From: | John Holmes | Date: | Sat, 20 Nov 2004 15:22:00 +0000 |
| Subject: | Re: Optimize Query Output | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37375@lists.php.net to get a copy of this message | ||
GH wrote:
I have the following query: SELECT A.Your query is never going to look like that. You use PHP to format the result set so it displays how you want it. As you loop through the returned rows, keep track of what the current first and last name are. If they change, then output them, otherwise output a blank cell. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.comAttID, S.SessionDate, P.LastName, P.FirstName, A.PresentFROMAttendanceA, Sessions S, Participants P WHERE S.SessionID = A.SessionAND P.Part_ID = A.ParticipantGROUP BY P.LastName, P.FirstName, A.Present, A.AttID I would like to have the output to have the P.LastName and P.FirstName values only shown once and the rest of the output printed... So instead of something like:| 1 | 2004-10-30 | Apple | Robert | Yes | | 11 | 2004-11-06 | Apple | Robert | Yes |To have it look like:| Apple | Robert S. | 1 | 2004-10-30 | Yes | | | | 11| 2004-11-06 | Yes | | | | 31| 2004-11-13 | Yes | | Bravo | Luz | 2 | 2004-10-30 | Yes | | | | 32| 2004-11-06 | No |