Code Comments
Programming Forum and web based access to our favorite programming groups.Usse PHP to control the output, test for the value and if it changes show else don't show it bastien >From: GH <garyhotko@gmail.com> >Reply-To: GH <garyhotko@gmail.com> >To: php-db@lists.php.net, mysql@lists.mysql.com >Subject: [PHP-DB] Optimize Query Output >Date: Sat, 20 Nov 2004 00:39:36 -0500 > >I have the following query: > >SELECT A.`AttID` , S.`SessionDate` , P.LastName, P.FirstName, A.`Present` >FROM `Attendance` A, Sessions S, Participants P >WHERE S.SessionID = A.`Session` AND P.Part_ID = A.`Participant` >GROUP 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: > >+-------+-------------+-------------+-----------+---------+ >| AttID | SessionDate | LastName | FirstName | Present | >+-------+-------------+-------------+-----------+---------+ >| 1 | 2004-10-30 | Apple | Robert | Yes | >| 11 | 2004-11-06 | Apple | Robert | Yes | >| 31 | 2004-11-13 | Apple | Robert | Yes | >| 2 | 2004-10-30 | Bravo | Lisa | Yes | >| 32 | 2004-11-13 | Bravo | Lisa | Yes | >| 12 | 2004-11-06 | Bravo | Lisa | No | >| 3 | 2004-10-30 | Beta | Elaine | Yes | >| 13 | 2004-11-06 | Beta | Elaine | Yes | >| 14 | 2004-11-06 | Delta | Alexander | Yes | >| 35 | 2004-11-13 | Delta | Alexander | Yes | >.... > > >To have it look like: > >+-------------+-----------+-------+-------------+---------+ >| LastName | FirstName | AttID | SessionDate | Present | >+-------------+-----------+-------+-------------+---------+ >| 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 | >| | | 12| 2004-11-13 | Yes | >| Beta | Elaine | 3 | 2004-10-30 | Yes | >| | | 13| 2004-11-06 | Yes | >| Delta | Alexander | 14 | 2004-11-06 | Yes | >| | | 35| 2004-11-13 | Yes | >..... > >Please advise I am running on mySql 4.0 > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php >
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.