Hi All,I am pretty much new/naive in writing complex SQLs in an effecient way. I have a requirement where I need to write a complex SQL in an effecient way. The requirement is as follows:I have a table 'testtable' with columns 'testid' and 'testcolumn' which has values like the following:TESTID TESTCOLUMN------ ----------112 Red,Green789 Green,Yellow535 Brown,Red97 Blue,Green,Cyan1174 White,Brown,Yellow
I need to write a SELECT query which would give me all the distinct colors present in the column (irrespective of the commas), for all testids < 1000. My output should be something like: (Sorted/Unsorted is fine)OUTPUT------BlueBrownCyanGreenRedYellow
If you look at the output, all colors are present only once (DISTINCT) and White is not present due to the condition (< 1000).My real table has around 30000 records and I really need an effecient query which can do this job so that there is no performance hit.Thanks in Advance. Let me know for any questions.Bharath