Problem request can be resolved in the next versions

2003-12-03 Thread lamjoun
Hi,
I have a problem with this request.

insert into table month_var (year,month,var_cd,val)  select
'2003','10',var_cd,0 from var and
var_cd not in (select var_cd from month_var where year='2003' and
month='10');
thanks


RE: Problem request can be resolved in the next versions

2003-12-03 Thread Mike Johnson
From: lamjoun [mailto:[EMAIL PROTECTED]

 Hi,
 I have a problem with this request.
 
 insert into table month_var (year,month,var_cd,val)  select
 '2003','10',var_cd,0 from var and
 var_cd not in (select var_cd from month_var where year='2003' and
 month='10');
 thanks


This isn't a problem request to be resolved in the next versions. You're simply 
using incorrect MySQL syntax.

Since you've now posted this three times with no further explanation of what you're 
trying to get at, one can only assume you're trying to perform an INSERT INTO...SELECT 
FROM that'd be helped by using a join of some sort.

If you're trying to limit it based on values found or not found in another table, as 
it appears, try something like...

INSERT INTO month_var (year, month, var_cd, val)
SELECT '2003', '10', var.var_cd, '0' FROM var
LEFT JOIN month_var ON month_var.var_cd=var.var_cd
WHERE month_var.year='2003'
AND month_var.month='10'
AND month_var.var_cd IS NULL

I don't have your table structure and, actually, am not entirely sure of what you're 
aiming for, so I don't know if that above query works. If not, try looking at the 
manual.

INSERT...SELECT syntax
http://www.mysql.com/doc/en/INSERT_SELECT.html

JOIN syntax
http://www.mysql.com/doc/en/JOIN.html



-- 
Mike Johnson
Web Developer/Systems Asst.
Smarter Living, Inc.
phone (617) 497-2500 x226

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]