staleb
asked on
Update dpending on combination of two columns
Hi
I have a table UserCompany:
CompanID
UserID
DefaultCompany
A user can have serveral rows in the table, connected to several Companies.
I want to update the row with the min(CompanyID) and set defauly = true:
I can select the rows:
Select min(CompanyID) as comp,UserID
from UserCompany uc
where DefaultCompany <> 1
group by UserID
But can seem to figure out how to update the same rows?
I have a table UserCompany:
CompanID
UserID
DefaultCompany
A user can have serveral rows in the table, connected to several Companies.
I want to update the row with the min(CompanyID) and set defauly = true:
I can select the rows:
Select min(CompanyID) as comp,UserID
from UserCompany uc
where DefaultCompany <> 1
group by UserID
But can seem to figure out how to update the same rows?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I was so close, but still so far away