I have a table ...
ID TXT
1 dogfood
1 catfood
1 catfood
1 catfood
2 dogfood
3 dogfood
3 <null>
4 <null>
5 dogfood
5 dogfood
5 dogfood
and I want it to produce ...
ID TXT
1 mixed
2 dogfood
3 mixed
4 <null>
5 dogfood
(in other words, if all txt values are the same for an id, return that value; if there is at least one difference, return 'mixed'
I need to do this in SQL, and not in PL/SQL. It's driving me nuts!
Any ideas? Am I missing something obvious?
ID TXT
1 dogfood
1 catfood
1 catfood
1 catfood
2 dogfood
3 dogfood
3 <null>
4 <null>
5 dogfood
5 dogfood
5 dogfood
and I want it to produce ...
ID TXT
1 mixed
2 dogfood
3 mixed
4 <null>
5 dogfood
(in other words, if all txt values are the same for an id, return that value; if there is at least one difference, return 'mixed'
I need to do this in SQL, and not in PL/SQL. It's driving me nuts!
Any ideas? Am I missing something obvious?