Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Query to display unique comments based on certain conditions

$
0
0
TABLE DEFINITIONColumn Name CommentsCustomerID INTSequenceNo INTComments VARCHAR(MAX)CUSTOMER TABLECustomerID SequenceNo Comments1 1 ABC D1 2 CDE1 3 ABC1 4 ABC D1 5 CDE1 6 abc2 7 ABC DEF2 8 2 9 ABC DEF2 10 DEF2 11 XYZ 1232 12 ABC3 13 PQ RSTOUTPUTCustomerID SequenceNo Comments1 3 ABC1 4 ABC D1 5 CDE1 6 abc2 8 2 9 ABC DEF2 10 DEF2 11 XYZ 1232 12 ABC3 13 PQ RSTRecords should be filtered by 1. Display only Unique Comments from Customer Table for all the customers,2. If Comments are same then display the row which has maximum SequenceNo[img]https://www.dropbox.com/s/h0t3xvvvlaqirk3/11698890_10154036087194466_3495075191431781854_o.jpg?dl=0[/img]

Viewing all articles
Browse latest Browse all 3145

Trending Articles