[thelist] complicated sql

Comitque comitque at hotmail.com
Sun Dec 7 21:28:32 CST 2003


Hey everyone, I have a complicated SQL query but I can't produce the results
that I want...

I have three tables.  it looks something like this:
(the site is for a venue/club)

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...

Any ideas what I'm doing wrong?  I'd really appreciate the help.

Thanks!


More information about the thelist mailing list