sql, grouping problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to group the output of a query.
I can do it with cold fusion but cannot figure it out using php.

Currently I display a list of classes:

  +------------------+----------+------------+
  | CLASS TITLE      | LOCATION | CLASS CODE |
  +------------------+----------+------------+
  | CLASS DESCRIPTION <br/><br/>             |
  | CLASS INSTRUCTOR <br/><br/>              |
  | CLASS TIME                               |
  +------------------------------------------+
 
 
  Now, things are getting a little more complicated.  Each
  class is going to have sections. So the display will be:
 
  CLASS TITLE
  CLASS DESCRIPTION
 
  CLASS CODE : CLASS SECTION .. LOCATION .. CLASS TIME .. INSTRUCTOR
 
  example below
 
  +---------------------------------------------+
  | INTRO TO AAA                                |
  +---------------------------------------------+
  | This is a really interesting ....           |
  |                                             |
  +---------+-----+------------+----------------+
  |HT-111:A | NYC | 12:00-4:00 | Albert Alkin   |
  |HT-111:B | JC  | 2:00-6:00  | Bob Bailey     |
  |HT-111:C | BX  | 4:00-8:00  | Chris Cawley   |
  +---------+-----+------------+----------------+
 
 cold fusion allows you to group output (see below)


  Select c.classId, c.classTexts, c.classDescription,
  cc.classCodeSection, cc.classDate, cc.classTime,
  cc.classLocation, cc.classInstructor
  FROM CLASSES c, CLASSCODES cc
  WHERE c.classId = cc.classId
  AND ...
  ORDER BY c.classId, ...

  <cfoutput query="myQuery" group="classId">
  	#classTitle#
  	#classDescription#<br>...
  <cfoutput>
  
    #classCodeSection#<br>
    #classDate#<br>
    #classTime#<br>

  </cfoutput>
  </cfoutput>

I can't figure out how to do this in php.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux