quote:
Ah! Problem is me, me thinks. Sometimes it's difficult to explain what u have and what u want to someone else but I think we are getting there. I agree that a cursor could be a solution but I am trying to keep to set based as much as possible to satisfy the purists (albeit with loops).Since we are so close can u clarify things a bit further. Based on your last post if the data is
1 A Y
1 B N
1 C Y
2 A N
2 B Y
2 C N
What exactly should the output be.
As to how long. Depends on volume. You said you have 50+ products, can u indicate how many responses there are. What is the definition of product, if you have 50+ they cannot be 1 char!!
Personally I think a cursor will be the only way to accomplish this due to the unknown factor raised when you change the number of options 3 or 50 or 100 etc. However, take a look at this script at anyone who wants to incorporate might find it will help http://qa.sqlservercentral.com/scripts/contributions/204.asp. Note: There is a small bug in the script I haven't corrected yet but when I get a chance I will, if you find a way to correct let me know.