[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] SQL INSERT
-----Original Message-----
From: interchange-users-admin@interchange.redhat.com
[mailto:interchange-users-admin@interchange.redhat.com]On Behalf Of
Scott Andreas
Sent: Monday, February 04, 2002 10:50 AM
To: 'IC mailing list'
Subject: [ic] SQL INSERT
hello list,
I'm still having trouble with an INSERT command based on a select
Is what I want is in my contacts table I'm selected certain criteria and
then inserting a note into my contactnotes table certain values
Here's what I have so far
contactnotes mysql table headers:
________________________________________
| | | |
code + contactno + note + source + date
_____|___________|______|________|______
[tmp dropdate][tag op=time]%Y%m%d[/tag][/tmp]
[tag flag write]contactnotes[/tag]
[query list=1
st=db
table=contactnotes
sql="INSERT INTO contactnotes (contactno, notes, source, date) values
(SELECT catalogs.code, 'show catalog sent to user' , 'catalogs' ,
'[scratch dropdate]'
FROM catalogs
WHERE country = 'US' AND show_qty = '1' AND completed != '1')
"]
[/query]
The values that I want to insert into contactnotes are
code = AUTO_INCREMENT
contactno = catalogs.code <--- code column from catalogs table
note = Show catalog sent to user
source = catalogs
date = [scratch dropdate]
All based on the select statement
The error file shows...
/intranet/admin/insert_contactnotes.html Bad SQL statement: Parse error near
SELECT catalogs.code, 'show catalog sent to user' , 'catalogs' , '20020207'
FROM catalogs
WHERE country = 'US' AND show_qty = '1' AND completed != '1')
Query was: INSERT INTO contactnotes (contactno, notes, source, date) values
(SELECT catalogs.code, 'show catalog sent to user' , 'catalogs' ,
'20020207'
FROM catalogs
WHERE country = 'US' AND show_qty = '1' AND completed != '1')
Any help would be appreciated
J. Scott Andreas :)
IS/Programmer/WebDevelopement
Learning Services, Inc.
e-mail: sandreas@learningservicesinc.com
phone: 1-800-877-9378 ext. 146
fax: (541) 744-2056
--- __o
--- _-\<,_
--- (_)/ (_)
_______________________________________________
interchange-users mailing list
interchange-users@interchange.redhat.com
http://interchange.redhat.com/mailman/listinfo/interchange-users
- Follow-Ups:
- [ic] SQL INSERT
- From: interchange-users@interchange.redhat.com (Scott Underwood)