Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Johnyalm
Starting Member
49 Posts |
Posted - 2003-10-14 : 06:22:57
|
| I get this error Server: Msg 156, Level 15, State 1, Line 3Incorrect syntax near the keyword 'SELECT'.for this statementINSERT INTO tblGILSEARCH (id_actors)VALUES SELECT DISTINCT id_actors FROM tblFORMDATA WHERE tblFORMDATA.FormID = '105115662'Please help meJohnywww.mirrorgate.com |
|
|
OMB
Yak Posting Veteran
88 Posts |
Posted - 2003-10-14 : 07:15:41
|
| JohnyJust get rid of the Values condition.i.e.INSERT INTO tblGILSEARCH (id_actors)SELECT DISTINCT id_actors FROM tblFORMDATA WHERE tblFORMDATA.FormID = '105115662'OMBOMB |
 |
|
|
Johnyalm
Starting Member
49 Posts |
Posted - 2003-10-14 : 07:19:12
|
| Thanx!Next problem I have is an UPDATE statementI get an error for this statement as well:UPDATE tblGILSEARCH SET stadsdel =SELECT DISTINCT Result AS stadsdelFROM tblFORMDATA INNER JOIN tblGILSEARCH ON tblFORMDATA.id_actors = tblGILSEARCH.id_actors WHERE dbo.tblFORMDATA.Ctrlname = 'stadsdel' AND dbo.tblFORMDATA.FormID = '105115662'www.mirrorgate.com |
 |
|
|
OMB
Yak Posting Veteran
88 Posts |
Posted - 2003-10-14 : 07:31:44
|
| Are you trying to update the whole table or just one row, this looks like your updating the whole table. |
 |
|
|
drymchaser
Aged Yak Warrior
552 Posts |
Posted - 2003-10-14 : 08:56:08
|
Here is an update on your two tables be sure it delivers the results you desire before executing.Run just select in QA first:UPDATE a SET a.Stadsdel = b.result--- SELECT a.id_actors, a.Stadsdel, b.resultFROM tblGILSEARCH a INNER JOIN tblFORMDATA b ON a.id_actors = b.id_actorsWHERE b.Ctrlname = 'stadsdel' and b.FormID = '105115662' |
 |
|
|
|
|
|