[ic] SQL INSERT

Scott Andreas interchange-users@interchange.redhat.com
Mon Feb 4 13:59:01 2002


hello list,

I'm 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
_____|___________|______|________|______


INSERT INTO contactnotes
	SELECT code, country, show_qty, completed
	FROM contacts
	WHERE country = US AND show_qty = 1 AND completed != 1

The values that I want to insert into contactnotes are
code = AUTO_INCREMENT
contactno = code.contacts
note = Show catalog sent to user
source = catalogs
date =$tag->time{%Y%M%d}

All based on the select statement

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
     ---   _-\<,_
      --- (_)/ (_)