Table 1
Color
------
Red
Red
Blue
Table 2
Color
------
Red
Blue
Result
Red (since red in Table 1 2x and only 1x in Table 2)
How can I design the TSQL to delete rows in Table 1 based on the rows in Table 2?
In other words, iterate Table 2 one time and for each color, delete one color from Table 1 (not all the colors that equal current color of Table 2).
delete from table1 where color in (select color from table2)this will delete rows which are in table 2..Table2has more than one row with the sameColor? Your sample data doesn't cover many cases, it would help if you added more rows to it.