Webbo_1980
asked on
How do i get the contents/Id of a of a field for a nested query if its contained in a parent query
I've got the following query i.e.
INSERT INTO Table1(value1,value2,value 3)
SELECT ID, * FROM Table2
WHERE Column2 NOT IN
(
SELECT DISTINCT ID FROM [Table3]
WHERE [column2]=Table2.ID AND userId=@userId
)
The question is based around the nested contents i.e.
SELECT DISTINCT ID FROM [Table3]
WHERE [column2]=Table2.ID AND userId=@userId
Is there anyway for Table2.id to come from the "SELECT * FROM Table2" query listed above it?
I hope this makes sense?
Thanks
Webbo
INSERT INTO Table1(value1,value2,value
SELECT ID, * FROM Table2
WHERE Column2 NOT IN
(
SELECT DISTINCT ID FROM [Table3]
WHERE [column2]=Table2.ID AND userId=@userId
)
The question is based around the nested contents i.e.
SELECT DISTINCT ID FROM [Table3]
WHERE [column2]=Table2.ID AND userId=@userId
Is there anyway for Table2.id to come from the "SELECT * FROM Table2" query listed above it?
I hope this makes sense?
Thanks
Webbo
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.