Here we need to write the Query to bring the which user Name have all color ( from Color table ) and we should not hardcode the color string and its should be dynamic query?

SELECT Name FROM (
    SELECT Name,count(pc.ColorCode) AS ColorCode from PersonColors pc
    INNER JOIN colorcode c ON pc.ColorCode = c.color
    GROUP BY Name) a GROUP BY name,colorcode
HAVING colorcode = (SELECT COUNT(1) FROM colorcode) 
				         
							
						 
								
														
							

 
									
								 
									
								
Leave a Reply