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 |
|
kifeda
Posting Yak Master
136 Posts |
Posted - 2007-12-21 : 16:25:02
|
| I wrote this update statement and it looks right but I keep getting an error that says "incorrect syntax next to c" what did I do wrong?Here is the statement:UPDATE tblclients cSET intproviderId = (SELECT TOP 1 t.inttransferid FROM tbltransfer t WHERE t.intclientids = c.intclientid ORDER BY t.inttransferid DESC) |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-12-21 : 17:00:39
|
try this:UPDATE cSET intproviderId = (SELECT TOP 1 t.inttransferid FROM tbltransfer t WHERE t.intclientids = c.intclientid ORDER BY t.inttransferid DESC)from tblclients c elsasoft.org |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-22 : 01:06:39
|
or this:-UPDATE cSET c.intproviderId = tmp.inttransferid from tblclients cCROSS APPLY (SELECT TOP 1 t.inttransferid FROM tbltransfer t WHERE t.intclientids = c.intclientid ORDER BY t.inttransferid DESC)tmp |
 |
|
|
kifeda
Posting Yak Master
136 Posts |
Posted - 2008-03-06 : 14:42:23
|
| I tried the last statement and it looks like ms sql server doesn't like cross apply |
 |
|
|
JasonL
Starting Member
35 Posts |
Posted - 2008-03-06 : 16:11:53
|
| UPDATE cSET intproviderId = (SELECT min(t.inttransferid) FROM tbltransfer t WHERE t.intclientids = c.intclientid))from tblclients cThis may work?JasonL |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-03-07 : 03:26:21
|
quote: Originally posted by kifeda I tried the last statement and it looks like ms sql server doesn't like cross apply
Did you try jazemine's query also?MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-03-07 : 04:13:02
|
quote: Originally posted by kifeda I tried the last statement and it looks like ms sql server doesn't like cross apply
CROSS APPLY requires SQL 2005 with compatability level set to 90 |
 |
|
|
|
|
|