look at using the "group_concat" function on OptionalDesc and group by the other fields.
On Mon, Sep 22, 2008 at 1:40 PM, Andre Matos <[EMAIL PROTECTED]>wrote: > Hello, > > I need help with a SQL Select statement: > > I have three tables: report, category, and optional > > a) "report" table has 3 fields: > > ReportId, CategoryId, ReportDesc > > b) "category" table has 2 fields: > > CategoryId, CategoryDesc > > c) "optional" table has three fields: > > OptionalId, CategoryId, OptionalDesc > > > I would like to have something like this: > > > ----------------------------------------------------------------------------------- > | ReportId | CategoryDesc | OptionalDesc | ReportDesc | > > ----------------------------------------------------------------------------------- > | 0001 | Example 1 | late, query, test | report desc abc | > | 0002 | Example 2 | query | test 123 > | > | 0003 | Example 3 | | test xzy > | > | 0004 | Example 1 | late, test | report desc abc > | > > ----------------------------------------------------------------------------------- > > However, when performing my SELECT using LEFT JOIN, I am getting something > like this: > > > ----------------------------------------------------------------------------------- > | ReportId | CategoryDesc | OptionalDesc | ReportDesc | > > ----------------------------------------------------------------------------------- > | 0001 | Example 1 | late | report desc > abc | > | 0001 | Example 1 | query | report desc abc > | > | 0001 | Example 1 | test | report desc > abc | > | 0002 | Example 2 | query | test 123 > | > | 0003 | Example 3 | | test xzy > | > | 0004 | Example 1 | late | report desc > abc | > | 0004 | Example 1 | test | report desc > abc | > > ----------------------------------------------------------------------------------- > > > Is it possible to have the column "OptionalDesc" as showed in the first > table above? > > Thanks for any help. > > Andre > > -- > Andre Matos > [EMAIL PROTECTED] > > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- Jim Lyons Web developer / Database administrator http://www.weblyons.com