Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Select one record from multiple based on a group by of column values

$
0
0
Column AColumn BOther columns
KS12233M122
KC12233M122
KC12555M122
KB12555M122

Requirement is, If I have Same Numeric values in column A (excluding the first two characters) for a value in Column B I need to select only one record out of the two/multiple records. Column A value will have either KS or KB or KC as prefix. If I have KS I have to use the record, if not then KB other wise KC. Out put that I am looking got the above data is like this.

Column AColumn BOther columns
KS12233M122
KB12555M122

Thanks,
Raja Ramesh Varma
http://my-devils-workshop.blogspot.com


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>