Jump to content

Displaying GROUP BY data


RyanMinor

Recommended Posts

hello,

 

i have a table in a database that stores information on powerpoint presentations like so:

 

id, title, filename, presenter, program, session

 

I want to query the data so that all entries are grouped by session (which is a date) and each presentation is displayed under its respective session in a table like so:

 

[session] (i want to display each session once)

    [title] - [program] (then i want to display this information for each presentation in each session)

    [presenter]

[session]

    [title] - [program]

    [presenter]

etc...

 

i am thinking of using group_concat for this but am not sure exactly how to pull it off. any help is greatly appreciated. thank you!

 

Link to comment
https://forums.phpfreaks.com/topic/235100-displaying-group-by-data/
Share on other sites

You would use ORDER BY session to get the rows in the order that you want, then in your php code, you would output the new heading any time the session value changes. See this link for some pseudo code - http://www.phpfreaks.com/forums/index.php?topic=331304.msg1559057#msg1559057

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.