What I want is to retrieve all ID''s Where the corresponding value of a color is higher then the corresponding value from a different color.
For example, I want where Value of 'Blue' is larger then the Value of 'Purple' Where the ID's match.
I have the following tables:
Table1
ID | Color | KeyA | KeyB
1 | Blue | AB | 13
1 | Green | AC | 15
1 | Purple | AG | 56
2 | Purple | DF | 46
2 | Pink | GH | 67
3 | Orange | GH | 89
3 | Green | YU | 97
Table2
KeyA | KeyB | Value
AB | 13 | 55
DF | 46 | 34
YU | 97 | 56
DF | 46 | 23
AG | 56 | 34
IN this example the result will be 1
Only the used Values:
Table1
ID | Color | KeyA | KeyB
1 | Blue | AB | 13
1 | Purple | AG | 56
Table2
KeyA | KeyB | Value
AB | 13 | 55
AG | 56 | 34
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…