Thank you, but I still get an error and I can't figure it out: " Unknown
column 's1.div_id' in 'on clause'"
Any other thoughts?
From: Martin Gainty [mailto:mgainty@stripped]
Sent: Saturday, August 16, 2008 9:50 AM
To: Andy Shellam; Steven Buehler
Subject: RE: Multiple Query/Insert help
the only possible suggestion i have would be to disambiguate the selected
columns with 'as'
insert into games2 (sea_id,date,time,loc_id,hteam,vteam,div_id)
'36' as sea_id, game_date as date, begin_time as time, loc_id as loc_id,
home_team_id as hteam, away_team_id as vteam, ts.div_id as div_id
From scheduler s1 INNER JOIN team_season ts ON ts.team_id =
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and Sender
does not endorse distribution to any party other than intended recipient.
Sender does not necessarily endorse content contained within this
> Date: Sat, 16 Aug 2008 15:40:08 +0100
> From: andy.shellam-lists@stripped
> To: steve@stripped
> CC: mysql@stripped
> Subject: Re: Multiple Query/Insert help
> Hi Steve,
> You're seeing this error because this query:
> select div_id
> from team_season where team_id=s1.div_id
> is being run independently of the rest, so it doesn't know of "s1" in
> this context. You would probably be better with an INNER JOIN here,
> something like the following (may need tweaking):
> insert into games2 (sea_id,date,time,loc_id,hteam,vteam,div_id)
> '36', game_date, begin_time, loc_id, home_team_id,
> scheduler s1 INNER JOIN team_season ts ON ts.team_id =
> Steven Buehler wrote:
> > I have a query that I just can't seem to get working.
> > insert into games2 (sea_id,date,time,loc_id,hteam,vteam,div_id) (select
> > '36',game_date,begin_time,loc_id,home_team_id,away_team_id,(select
> > from team_season where team_id=s1.div_id) from scheduler s1);
> > Of course, I am getting the dreaded "Unknown column 's1.div_id' in
> > 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
> > from the team_season table.
> > Any help would be appreciated
> > Thanks
> > Steve
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1
See what people are saying about Windows Live. Check out featured posts.