SQL statement

Kim Johnsson EMAIL HIDDEN
Thu May 27 20:46:59 CEST 2010


Hejsan!

> I'm having a bit of a trouble getting two different countryvalues in a
> single select statement
> ...
> Does anyone know how to do this?

2 countries on the same data row?

select
  b.bandname,
  bc.country as bandcountry,
  cc.country as contactcountry
from
  band as b inner join country as bc
    on b.country_id = bc.country_id
  inner join contact as c
    on b.contact_id = c.contact_id
  inner join country as cc
    on c.country_id = cc.country_id

maybe? Or with outer joins...

Cheers,

Kim



More information about the music-bar mailing list