Suppose I have an SQL query that looks like this:
SELECT fName from employees where ssn=123456789;
Suppose I want to execute a previous request with another:
SELECT fName from records WHERE ssn=123456789;
SELECT lName from records WHERE fName=(the result of the previous query)
What can I do (the result of the previous query)to return this name from the records where fName matches the supposedly unique record, where ssn = 123456789?
I know this is an unrealistic example, but I ask: "How can I refer to the result of my previous query?"
By the way, if that matters, I'm using MS SQL Server 2008. Thanks!
source
share