Reputation: 3415
I'm trying to update the max dog id value into the dogsID
column (in the DOGS
table) where dogs.breed
is 'pitbull' by getting the MAX
value of the dogID
column in the doggy_table
.
How can I accomplish this update statement?
I need a where statement at the end, but this is not proper syntax
update DOGS(dogsID)
values ( (SELECT MAX(dogID) as dogID
FROM doggy_table)
)
where [DOGS].[BREED] = 'pitbull'
Upvotes: 0
Views: 50
Reputation: 56
Perhaps you mean to do an update statement?
UPDATE dogs
SET dogsid = (SELECT Max(dogid) AS dogID
FROM doggy_table)
WHERE [dogs].[breed] = 'pitbull'
Upvotes: 4