[thelist] complicated sql

Plunkett, Matt MPlunkett at MSA.com
Mon Dec 8 09:51:19 CST 2003


> BANDS
> band_id | band_name

> SHOW INFO
> show_id | show_date | band_id (same id as the bands.band_id)

> PHOTOS
> photo_id | photo_name | photo_bandid (same id as the bands.band_id)

> How do I write a query to retrieve BANDS.band_name, SHOWINFO.show_date,
and
> PHOTOS.photo_name?  I had this:

> SQLQuery = "select * from showinfo, bands, photos where (bands.band_id =
> photos.photo_bandid and showinfo.band_id = bands.band_id) order by
> showinfo.show_date"

> But that didn't quite work...

I don't see any reason for your SQL not to work as written (except that I
would suggest explicitly naming only the columns you want selected)...how is
it not working?  


More information about the thelist mailing list