S
sean
Hi There,
I am trying to select from a table where the particular id has duplicate
values, I would like to return only the values that are duplicated for that
particular id. When I run the statement on it's own I can return the results
without having the clause that accepts the Parameter, once I add the AND
clause in with the parameter the query returns all of the rows for that
particular id, rather than just to the duplicates.
Sean - Thanks in advance for your answer
!_------------------------- code
PARAMETERS pProductID Long;
SELECT OptionValue, ProductID
FROM product_options
WHERE product_options.ProductID=pProductID
AND OptionValue in
( select OptionValue
from product_options
group by OptionValue
having count(*) > 1 );
!---------------table data ProductID OptionValue
7 XL
7 L
7 M
7 S
7 XS
7 M
7 L
!-- results of query OptionValue ProductID
XL 7
L 7
M 7
S 7
M 7
L 7
I am trying to select from a table where the particular id has duplicate
values, I would like to return only the values that are duplicated for that
particular id. When I run the statement on it's own I can return the results
without having the clause that accepts the Parameter, once I add the AND
clause in with the parameter the query returns all of the rows for that
particular id, rather than just to the duplicates.
Sean - Thanks in advance for your answer
!_------------------------- code
PARAMETERS pProductID Long;
SELECT OptionValue, ProductID
FROM product_options
WHERE product_options.ProductID=pProductID
AND OptionValue in
( select OptionValue
from product_options
group by OptionValue
having count(*) > 1 );
!---------------table data ProductID OptionValue
7 XL
7 L
7 M
7 S
7 XS
7 M
7 L
!-- results of query OptionValue ProductID
XL 7
L 7
M 7
S 7
M 7
L 7