UPDATE SecCounter
SET HHigh = Max ( SELECT TOP 200 C.High
FROM CONS C
GROUP BY C.CounterName
WHERE C.CounterName = S.CounterName
ORDER BY CounterDate DESC
)
, CloseV = Max ( SELECT TOP 1 C.CloseV
FROM CONS C
GROUP BY C.CounterName
WHERE C.CounterName = S.CounterName
ORDER BY CounterDate DESC
)
, AvgVol = Max ( SELECT TOP 200 C.Vol
FROM CONS C
GROUP BY C.CounterName
WHERE C.CounterName = S.CounterName
ORDER BY CounterDate DESC
)
FROM SecCounter S
WHERE S.Sector = 'CONS'
---------------------------------
Why the statement above wouldnt work in my SQL 2000. It keeps giving me the error message of
"Incorrect syntax near the keyword of 'SELECT' "
Please help!
Thanks!
Sherly
SET HHigh = Max ( SELECT TOP 200 C.High
FROM CONS C
GROUP BY C.CounterName
WHERE C.CounterName = S.CounterName
ORDER BY CounterDate DESC
)
, CloseV = Max ( SELECT TOP 1 C.CloseV
FROM CONS C
GROUP BY C.CounterName
WHERE C.CounterName = S.CounterName
ORDER BY CounterDate DESC
)
, AvgVol = Max ( SELECT TOP 200 C.Vol
FROM CONS C
GROUP BY C.CounterName
WHERE C.CounterName = S.CounterName
ORDER BY CounterDate DESC
)
FROM SecCounter S
WHERE S.Sector = 'CONS'
---------------------------------
Why the statement above wouldnt work in my SQL 2000. It keeps giving me the error message of
"Incorrect syntax near the keyword of 'SELECT' "
Please help!
Thanks!
Sherly