Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have records in the following format :

HTML
Style_no          Text        Age
JC001             Text1        1
JC001             Text1        1
JC001             Text1        1
JC002             Text9        9
JC002             Text9        9
JC002             Text9        9

Results Should be like this :

JC001             Text1        1
JC002             Text9        9



Each row with same style_no column must be selected only once. i hope you understand what i am saying.

I want to write sql query for the above condition based on style_no column. i tried so many queries but all in vain. any help would be appreciated..
Posted

1 solution

Given the source data you've provided, a simple SELECT DISTINCT would work:
SQL
SELECT DISTINCT
    Style_no,
    [Text],
    Age
FROM
    YourTable
;
 
Share this answer
 
v2
Comments
Maciej Los 20-Apr-15 14:30pm    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900