From: Martin Gainty Date: August 16 2008 3:56pm Subject: RE: Multiple Query/Insert help List-Archive: http://lists.mysql.com/mysql/214140 Message-Id: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="_c64e3878-ab25-4b45-a188-810cf05626c3_" --_c64e3878-ab25-4b45-a188-810cf05626c3_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Steve- apparently the column is not defined to that entity try replacing s1.div_id reference with ts.div_id or even better team_season= .div_id Martin=20 ______________________________________________=20 Disclaimer and confidentiality note=20 Everything in this e-mail and any attachments relates to the official busin= ess of Sender. This transmission is of a confidential nature and Sender doe= s not endorse distribution to any party other than intended recipient. Send= er does not necessarily endorse content contained within this transmission.= =20 > From: steve@stripped > To: mgainty@stripped=3B andy.shellam-lists@stripped > CC: mysql@stripped > Subject: RE: Multiple Query/Insert help > Date: Sat=2C 16 Aug 2008 10:10:15 -0500 >=20 > Thank you=2C but I still get an error and I can't figure it out: " Unknow= n > column 's1.div_id' in 'on clause'" > Any other thoughts? >=20 > Steve >=20 > -----Original Message----- > From: Martin Gainty [mailto:mgainty@stripped]=20 > Sent: Saturday=2C August 16=2C 2008 9:50 AM > To: Andy Shellam=3B Steven Buehler > Cc: mysql@stripped > Subject: RE: Multiple Query/Insert help >=20 >=20 > the only possible suggestion i have would be to disambiguate the selected > columns with 'as' >=20 > insert into games2 (sea_id=2Cdate=2Ctime=2Cloc_id=2Chteam=2Cvteam=2Cdiv_i= d)=20 > ( > select > '36' as sea_id=2C game_date as date=2C begin_time as time=2C loc_id as l= oc_id=2C > home_team_id as hteam=2C away_team_id as vteam=2C ts.div_id as div_id > From scheduler s1 INNER JOIN team_season ts ON ts.team_id =3D > s1.div_id > ) >=20 > Thanks Andy > Martin=20 > ______________________________________________=20 > Disclaimer and confidentiality note=20 > Everything in this e-mail and any attachments relates to the official > business of Sender. This transmission is of a confidential nature and Sen= der > does not endorse distribution to any party other than intended recipient. > Sender does not necessarily endorse content contained within this > transmission.=20 >=20 >=20 > > Date: Sat=2C 16 Aug 2008 15:40:08 +0100 > > From: andy.shellam-lists@stripped > > To: steve@stripped > > CC: mysql@stripped > > Subject: Re: Multiple Query/Insert help > >=20 > > Hi Steve=2C > >=20 > > You're seeing this error because this query: > >=20 > > select div_id > > from team_season where team_id=3Ds1.div_id > >=20 > > is being run independently of the rest=2C so it doesn't know of "s1" in= =20 > > this context. You would probably be better with an INNER JOIN here=2C= =20 > > something like the following (may need tweaking): > >=20 > > e.g. > >=20 > > insert into games2 (sea_id=2Cdate=2Ctime=2Cloc_id=2Chteam=2Cvteam=2Cdiv= _id)=20 > > ( > > select > > '36'=2C game_date=2C begin_time=2C loc_id=2C home_team_id=2C > away_team_id=2C ts.div_id > > from > > scheduler s1 INNER JOIN team_season ts ON ts.team_id =3D > s1.div_id > > ) > >=20 > >=20 > > Regards=2C > > Andy > >=20 > > Steven Buehler wrote: > > > I have a query that I just can't seem to get working. > > > > > > =20 > > > > > > insert into games2 (sea_id=2Cdate=2Ctime=2Cloc_id=2Chteam=2Cvteam=2Cd= iv_id) (select > > > '36'=2Cgame_date=2Cbegin_time=2Cloc_id=2Chome_team_id=2Caway_team_id= =2C(select > div_id > > > from team_season where team_id=3Ds1.div_id) from scheduler s1)=3B > > > > > > =20 > > > > > > Of course=2C I am getting the dreaded "Unknown column 's1.div_id' in > 'where > > > clause'" error message. > > > > > > I think the statement above shows what I am trying to do better than = me > > > explaining it. My only real problem is that the div_id needs to be > gotten > > > from the team_season table. > > > > > > =20 > > > > > > Any help would be appreciated > > > > > > Thanks > > > > > > Steve > > > > > > > > > =20 > >=20 > > --=20 > > MySQL General Mailing List > > For list archives: http://lists.mysql.com/mysql > > To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dmgainty@hotmail= .com > >=20 >=20 > _________________________________________________________________ > See what people are saying about Windows Live. Check out featured posts. > http://www.windowslive.com/connect?ocid=3DTXT_TAGLM_WL_connect2_082008 >=20 >=20 > --=20 > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dmgainty@stripped= om >=20 _________________________________________________________________ See what people are saying about Windows Live. Check out featured posts. http://www.windowslive.com/connect?ocid=3DTXT_TAGLM_WL_connect2_082008= --_c64e3878-ab25-4b45-a188-810cf05626c3_--