Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gmmastros on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statement inside insert

Status
Not open for further replies.

jscott

Programmer
Nov 13, 2000
7
US
I am trying to select values from one table and load them into another.
This is the code I have

mysql> insert into tblTemp2(abFirst, abLast, abID_temp) values(
-> select abFirst, abLast, concat(substring(abFirst, 1, 1), substring(abLast, 1, 1), abstractorID)from abstractor where abstractor.abLast is not null));

I can't seem to figure out how to use a select within and insert.
Is this not possible?
If so, why do I get an error stateing that I have a syntax error at the begining of my select statement?
Thanks
Jean
 
YOu don't need the values ...
eg .
mysql> INSERT INTO tbltemp2 (field1,field2)
SELECT tbltemp1.field1,tbltemp1.field2
FROM tbltemp1 WHERE ....

good luck.
devnull22
(Knowledge Base Center )

--
Apparently if you play the Windows NT CD backwards you hear satanic messages. If you think that's bad, play it forwards and it installs Windows NT !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top