> There is one record in the Events table for each event that an organization
> is promoting. For each event, there could be 0 to 'n' files that give more
> information about the event, such as pictures, audio clips, or whatever. I
> want to display all the information about the event, including all of the
> file names for that event, on a single result set row for each event,
> regardless of how many files exist for that event. [At the moment, there is
> a limit of 3 files per event but that could increase.]
>
> Can anyone suggest a query that would do what I need to do?

I'm not sure if there is a way to return multiple File columns but you could 
use the
GROUP_CONCAT function (added in MySQL 4.1) to obtain the files associated with 
the
event and parse the resulting list:

SELECT Event_ID, Event_Name
    (SELECT GROUP_CONCAT(File Separator '|') FROM Files WHERE Events.Event_ID =
Files.Event_ID) AS Files
FROM Events

-- 
<mack />


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to