I need a little help with a query that exceeds my T-SQL skills right now.
I need to make an update to a table where part of the criteria in my WHERE clause is in another table. To save time, I'd like to add an IN clause with a list to be compared.
In business speak, I need to update the rep number for counties in a state. The county field is in an extension table. The rest, in the main.
Here's what I've come up with and keep hitting roadblocks:
UPDATE maintable
SET maintable.salesperson = '123'
FROM maintable
INNER JOIN maintable AS main ON maintable_ext.custno = maintable.custno
WHERE [main].state = 'state' and [main].salesperson = '456' and maintable_ext.county = 'county' (this is where I'd like to put an IN clause)
After putting in a correlation name ([main]) I get an error stating "multi-part identifier could not be bound" for the...