OpsEngineer
OpsEngineer

Reputation: 33

Update on class, based on rid of sub-query

I want to do an update based on the@rid of a subquery.

select max(Visits.@rid) from Customers where @rid = #27:1074

returns the result #14:112

When I try the bellow code, the execution is successful, but no records are updated

UPDATE Visits Set exit_at = sysdate() where @rid = (select max(Visits.@rid) from Customers where @rid = #27:1074)

However, if i do

UPDATE Visits Set exit_at = sysdate() where @rid = #14:112

The record is update with the desired results.

What am I overlooking ?

Upvotes: 1

Views: 79

Answers (1)

Michela Bonizzi
Michela Bonizzi

Reputation: 2632

Try this:

UPDATE Visits Set exit_at = sysdate() where @rid IN (select max(Visits.@rid) from Customers where @rid = #27:1074)

Hope it helps.

Regards.

Upvotes: 3

Related Questions