Hi all.

3 tables. "Ticket"  "Pipeline_Dept", and "Ticket_Matrix".  Ticket_Matrix 
matches tickets to pipeline depts. A ticket can be posted to multiple pipeline 
depts. I want to select all tickets and the pipeline departments they are 
posted to but only one row per ticket. So:


SELECT                                                      
        t.ticketID,
        p.pipelineName                                   
FROM                                                        
        Ticket t                                            
        LEFT JOIN Ticket_Matrix tm                          
                ON t.ticketID   = tm.ticketID               
        LEFT JOIN Pipeline_Dept p                           
                ON p.pipelineID = tm.pipelineID 


 
This is what I want:
+----------+--------------------------+
| ticketID | pipelineName             | 
+----------+--------------------------+
|      163 | IT, Adv.Tech, R&D        |
|      164 | IT, R&D                  |
|      165 | Video, Multimedia        |
|      ... | ...                      |
+----------+--------------------------+

 
This is what I get now:
+----------+--------------------------+
| ticketID | pipelineName             | 
+----------+--------------------------+
|      163 | IT                       |
|      163 | Adv.Tech                 |
|      163 | R&D                      |
|      164 | IT                       |
|      164 | R&D                      |
|      165 | Video                    |
|      165 | Multimedia               |
|      ... | ...                      |
+----------+--------------------------+

I cannot do it with PHP because my query depends on LIMIT and returning a set 
number of rows. If I use PHP to do the concat-ing, the number of rows may be < 
LIMIT.

I appreciate any help.

kp




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to