List:General Discussion« Previous MessageNext Message »
From:Geoffrey Sneddon Date:June 7 2006 6:01pm
Subject:Re: Joins - Multiple rows from a single table
View as plain text  
On 7 Jun 2006, at 18:56, Peter Brawley wrote:

> Join users a second time for bugs.submitter, eg ...
>
> SELECT
>  bugs.id, bugs.title, UNIX_TIMESTAMP(bugs.submitted), bugs.fix,  
> bugs.assignee,
>  users.username,
>  users2.username AS Submitter,
>  bugs.category,
>  category.name,
>  bugs.version,
>  version.name,
>  bugs.priority, bugs.haspatch
> FROM fb_bugs AS bugs
> INNER JOIN fb_users AS users ON bugs.assignee = users.id
> INNER JOIN fb_users AS users2 ON bugs.submitter = users2.id
> INNER JOIN fb_category AS category ON bugs.category = category.id
> INNER JOIN fb_versions AS version ON bugs.version = version.id
>
> PB

Much thanks, that's saved me… this time. :)

All the best,

Geoffrey Sneddon.
Thread
Joins - Multiple rows from a single tableGeoffrey Sneddon7 Jun
  • Re: Joins - Multiple rows from a single tablePeter Brawley7 Jun
    • Re: Joins - Multiple rows from a single tableGeoffrey Sneddon7 Jun
    • Re: Joins - Multiple rows from a single tableGeoffrey Sneddon7 Jun