lets say i have a table C with following columns-
C1 C2 C3
1 2 3
1 4 9
2 3 1
1 4 7
3 9 6
1 1 1
2 2 2
3 3 3
now i want max value of c2 column corresponding to values c1 column.
means for c1= 1 max c2 = 4
but we have two values for c1=1 and c2=4. here i want any of the two values..
so the final out put would look something like this -
C1 C2 C3
1 4 7
2 3 1
3 9 6
first I used select c1,c2,c3 from C where (c1,c2)in (select c1, max(c2) from C group by c1);
but i was getting the out put...
c1 C2 C3
1 4 7
1 4 9
2 3 1
3 9 6
here i want just one row corresponding to C1=1.
please giud me how should i proceed.
regards
khushbu
C1 C2 C3
1 2 3
1 4 9
2 3 1
1 4 7
3 9 6
1 1 1
2 2 2
3 3 3
now i want max value of c2 column corresponding to values c1 column.
means for c1= 1 max c2 = 4
but we have two values for c1=1 and c2=4. here i want any of the two values..
so the final out put would look something like this -
C1 C2 C3
1 4 7
2 3 1
3 9 6
first I used select c1,c2,c3 from C where (c1,c2)in (select c1, max(c2) from C group by c1);
but i was getting the out put...
c1 C2 C3
1 4 7
1 4 9
2 3 1
3 9 6
here i want just one row corresponding to C1=1.
please giud me how should i proceed.
regards
khushbu