thanks everyone who reply me.Sorry infect I fail to communicated my requirement 1st time.I wish to get random min record per value of col_1 in case of draw. drop table T1;create table T1(col_1 smallint,Col_2 varchar(10),Col_3 int,);insert into T1 values (1,'abc',10);insert into T1 values (1,'pqr',10);insert into T1 values (1,'xyz',12);insert into T1 values (2,'abc',17);insert into T1 values (2,'xyz',15);insert into T1 values (2,'pqr',15);insert into T1 values (3,'abc',14);insert into T1 values (3,'pqr',16);insert into T1 values (3,'XYZ',14);select * from T1;
Out putcol_1 Col_2 Col_31 abc 101 pqr 101 xyz 122 abc 172 xyz 152 pqr 153 abc 143 pqr 163 XYZ 14
I need single min(col_3) value against every distinct value of Col_1.If for single value of Col_1 there are multiple values min(col_3), then they show randomly.as undercol_1 Col_2 Col_31 abc 102 pqr 153 abc 14
Next execution will be like col_1 Col_2 Col_31 pqr 102 pqr 153 XYZ 14
Wishes