Re: Left Join Help

2006-06-24 Thread Daniel McQuay
the thing with JOINs are you gotta JOIN a table ON another table where something matches something else (in most cases). I tried to clean this up a bit but im rather new to mysql. SELECT DISTINCT (td.td_id), td.venue_id as ven_id, td.td_date as td_date, art.NAME as art_name, art.WEB as art_url, a

Re: Left Join Help SOLVED

2006-06-23 Thread Paul Nowosielski
Thank you all so much for your help, here is my solution: (I'm sure I can do a little more optimization) SELECT DISTINCT (td.td_id) ,td.venue_id as ven_id, td.td_date as td_date, art.NAME as art_name,art.WEB as art_url, artd.artist_id as art_id, tv.ID, tv.NAME as ven_name, tv.ADDR1 ven_add0, tv.A

Re: Left Join Help

2006-06-23 Thread Peter Brawley
Paul, >SELECT ... >FROM > tourdates td, > tbl_ARTST as art, > artist_tourdate artd , > tbl_VENUES tv, > tbl_VENUE_CAPACITY tvc , > tbl_VENUE_AGE_XREF tvax, > tbl_VENUE_AGES tvage >LEFT JOIN tbl_VENUE_CAPACITY ON (tv.ID=tvc.VENUE_ID) >LEFT JOIN tbl_VENUE_AGE_XREF ON (tv.ID=tvax.VENUE_ID) >L

Re: Left Join Help

2006-06-23 Thread Gerald L. Clark
I ammend my previous post. Paul Nowosielski wrote: Dear All, I've been hashing out this query for awhile with no luck as of yet. Basically the query works if I put a limit of 500 or so but when I do the full query it takes up so many resource that the database engine is useless. Here is the

Re: Left Join Help

2006-06-23 Thread Brent Baisley
Here is your query rephrased a bit. I find this query structure easier to debug, especially when their are lots of joins. This is also the preferred structure in mysql 5 as I recall. Notice the ON ? part of the join. You didn't specify anything join condition so your doing a full join, very very b

Re: Left Join Help

2006-06-23 Thread Gerald L. Clark
Paul Nowosielski wrote: Dear All, I've been hashing out this query for awhile with no luck as of yet. Basically the query works if I put a limit of 500 or so but when I do the full query it takes up so many resource that the database engine is useless. Here is the query: SELECT DISTINCT (td.

Re: LEFT JOIN help (or "come and slap the newbie")

2003-12-29 Thread Hans van Harten
Dan Hansen wrote: > is essentially giving me what I need: > > CREATE TEMPORARY TABLE temptable > SELECT state.name AS state , group.name AS group, > group.zip AS zip, city.name AS city > FROM city, group, zip > LEFT JOIN state ON city.state_id = state.id > WHERE group.zip = zip.zip > AND zip.city_

Re: LEFT JOIN help (or "come and slap the newbie")

2003-10-15 Thread Dan Hansen
For everyone who helped, THANK YOU!! For anyone who might be interested, here's what finally did the trick and is essentially giving me what I need: CREATE TEMPORARY TABLE temptable SELECT state.name AS state , group.name AS group, group.zip AS zip, city.name AS city FROM city, group, zip LEFT J

Re: LEFT JOIN help (or "come and slap the newbie")

2003-10-15 Thread Roger Baklund
* D. R. Hansen > At 03:51 AM 10/15/03, Diana Soares wrote: > >You're confusing the left/right "sides" of LEFT JOIN... > >Using LEFT JOIN, it is the right table that is dependent on the left > >table. All results from left table are selected. > >So you may try: [...] > I believe I tried that -- but

Re: LEFT JOIN help (or "come and slap the newbie")

2003-10-15 Thread D. R. Hansen
I believe I tried that -- but when I did (and I just repeated it with the same result) mysql effectively hangs (i.e. the query takes interminably long -- I let it run for 20 minutes before killing it). So should I be looking at an indexing issue? Right now the only things indexed in the tables

Re: LEFT JOIN help (or "come and slap the newbie")

2003-10-15 Thread Diana Soares
You're confusing the left/right "sides" of LEFT JOIN... Using LEFT JOIN, it is the right table that is dependent on the left table. All results from left table are selected. So you may try: SELECT state.name AS state , group.name AS group, group.zip AS zip, city.name as city FROM state LEF

Re: left join help

2003-07-09 Thread Bruce Feist
Rick Pasotto wrote: One of these days I will maybe understand... A "left join" (t1 LEFT JOIN t2 ON ) is defined as follows. For each row in t1, find all matching rows in t2 and return the combination of t1 and t2 found. If there are no t2s for a t1, leave the t2 values NULL in the result. Try