In my application, there are publishers and categories. One publisher can belong to several categories. When I make my mysql transaction, it will return the same publisher record for each category it belongs to. Here's the query:
SELECT
grdirect_publisher.name,
grdirect_publisher.short_description,
grdirect_publisher.thumb_image,
grdirect_publisher.url,
grdirect_category.name AS catname
FROM
grdirect_publisher
JOIN
grdirect_publisher_categories
ON
grdirect_publisher.id = grdirect_publisher_categories.publisher_id
JOIN
grdirect_category
ON
grdirect_publisher_categories.category_id = grdirect_category.id
returns:
name short_description thumb_image url catname ------------------------------------------------------------ Foo Lorem Ipsum... images/pic.png d.com Video Games Foo Lorem Ipsum... images/pic.png d.com Music Bar Blah Blah... images/tic.png e.com Music
Essentially, Foo should only show up once in the results.