Hi all,
I am fairly new to T-Sql, so please be patient if this is a fairly dumb question:
basically, I have a table where a column has to be filled based on another table.
Here we go:
SELECT DISTINCT(personID) FROM dbo.tbl1 WHERE location = ''
GO
SELECT location FROM dbo.tbl2 WHERE personID = @resultfromtbl1 <<-??
GO
UPDATE dbo.tbl1 SET location=@resultfromtbl2 WHERE personID= <<-??
Now I dont know where to store the resultsets, how to tell T-SQL to loop on query2 and then loop on update statement for each resultset there....
Can anyone please point me to the right direction?
Thanks!
Mike