>
> I guess I am having an off day with SQL. I think technically
> this should work but I get a syntax error
>
> UPDATE Account a
>
> SET a.last_update = (SELECT TOP 1 h.tranDate
>
> FROM History h
>
> WHERE a.Account_Number = h.Account_Number
>
> ORDER BY h.tranDate DESC)
>
> Basically what this is supposed to do is look at each account
> number in the account table. Go to the history table for that
> account number and grab the last date it sees for the history
> of that account number and populate the account table with that date.
I'll have to dig something up...
But - look into (like Ben said)
UPDATE table
SET fields
FROM table2
WHERE
The problem with some SQL engines is that it doesn't allow aliasing of
the UPDATE table, so you'd have to refer to that by name, but you can
alias any of the tables in the FROM
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

