All Forums Tools
az_maverick 24 posts Joined 03/09
30 Mar 2009
Intersection of a set of queries in a cursor

Hello all, I am trying to code a cursor/procedure as follows, I have a set of queries . The queries differ only by a single variable value.An example would be ..select * from ABC where X = 'Y' & U = 'V'select * from ABC where X = 'Y' & U = 'M'The variable U is a column in another table , which I will join in the cursor.At the moment my query loosk like ,select * from ABC where X = 'Y' & U = 'V'INTERSECT ( select * from ABC where X = 'Y' & U = 'M' INTERSECT ( select * from ABC where X = 'Y' & U = 'N' ))I want to do this intersection 'n' number of times , until all distinct values of the column 'U' have been tested .For this I plan to use a cursor/ procedure.However , i am finding it difficult to implement the query .Any suggestions...Regards,az_maverick

You must sign in to leave a comment.