Hello,
I need some help with a sql query. Here's my scenario:
I have a table like this:
ID | Value
10 | 45
10 | 46
10 | 47
11 | 45
11 | 46
12 | 45
What I need to do is create a stored procedure that would return mutual exclusive set of values for any number of id's passed in as parameters.
For instance:
Parameters passed in: id = 10, id = 11
Return set:
45
46
(47 would not be in the set, since it's not common to both 10 and 11).
Example 2.
Parameters passed in: id = 10, id = 11, id = 12
Return set:
45
(that's the only number all three IDs have in common).
I do not know the number of IDs that should be passed in since that depends on user selected inputs.
Any help would be GREATLY appreciated.
Thank You
I need some help with a sql query. Here's my scenario:
I have a table like this:
ID | Value
10 | 45
10 | 46
10 | 47
11 | 45
11 | 46
12 | 45
What I need to do is create a stored procedure that would return mutual exclusive set of values for any number of id's passed in as parameters.
For instance:
Parameters passed in: id = 10, id = 11
Return set:
45
46
(47 would not be in the set, since it's not common to both 10 and 11).
Example 2.
Parameters passed in: id = 10, id = 11, id = 12
Return set:
45
(that's the only number all three IDs have in common).
I do not know the number of IDs that should be passed in since that depends on user selected inputs.
Any help would be GREATLY appreciated.
Thank You
Comment