From: Peter Brawley Date: June 2 2009 4:44pm Subject: Re: Question about query - can this be done? List-Archive: http://lists.mysql.com/mysql/217771 Message-Id: <4A255700.7040302@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------060702090005080507050304" --------------060702090005080507050304 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Ray, >I want a query that will provide one record per event with all times included. >feel free to answer RTFM or STFW as long as you provide the manual section or >key words. ;) Can be done with a pivot table. Examples under "Pivot tables" at http://www.artfulsoftware.com/infotree/queries.php. If you get stuck, pipe up. PB ----- Ray wrote: > Hello, > > I've tried the manual and google, but I am not even sure what to call what I > want to do. > > simplified data example: > I have a table of start and end times for an event, and an id for that event > in a table. each event may occur multiple times, but never more than 5 times > and rarely more than 3. > I want a query that will provide one record per event with all times included. > feel free to answer RTFM or STFW as long as you provide the manual section or > key words. ;) > Thanks, > Ray > > > chart form follows: > > id | event_id | start | end > --------------------------------------- > 1 | 4 | t1 | t2 > 2 | 4 | t3 | t4 > 3 | 4 | t5 | t6 > 4 | 5 | t1 | t2 > 5 | 5 | t3 | t4 > > becomes > > id | event_id | start | end | start | end | start | end > --------------------------------------------------------------------------- > ? | 4 | t1 | t2 | t3 | t4 | t5 | t6 > ? | 5 | t1 | t2 | t3 | t4 > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.339 / Virus Database: 270.12.50/2150 - Release Date: 06/02/09 06:47:00 > > --------------060702090005080507050304--