The following code is part of a UNION in a stored procedure. The second select is used again verbatim later on in the code. Is it possible to assign the results of that select to a variable before I do anything else, and then use it where I need it. I understand how to do this with @@Identity on inserts, but I'm confused here...Also, does the approach I'm taking cause a performance hit or is it negligible as the query is cached? select SectionMapCoords as MapCoords, SectionTitle as AltText,FileLink from tblSection s inner join tblSubSection ss on s.SectionID = ss.FK_SectionID inner join tblFile f on ss.SubSectionID = f.FK_SubSectionID where FileOrder = 1 and SubSectionOrder = 1 and SectionID <> ( select SectionID from tblSection s inner join tblSubSection ss on s.SectionID = ss.FK_SectionID inner join tblFile f on ss.SubSectionID = f.FK_SubSectionID where FileLink = @FileLink )
Edited by - PiecesOfEight on 02/06/2001 09:41:21