April 26, 2004 at 11:12 pm
I have a database table like below with 2 columns
CCode, CName
1A John
2A Dean
3A Schel
3A Mahata
Now i want to return the resultset from the query as
CCode, CName
1A John
2A Dean
3A Schel
(where I want to return values for all unique values for CCode column and its corresponding cname column)
Thanks
April 27, 2004 at 2:25 am
Not too sure if you have a preference for what Name comes back in the query
Eg : what name do you want for the 3A code, Schel or Mahata ?? Do you have a unique ID field in the table ???
- This will pull back the code and one of the corresponding names ?
SELECT CCode,MAX(CName)
from TABLE
GROUP BY CCode
ORDER BY CCode
Please give more info on table structure and desired result....
April 28, 2004 at 5:41 am
| |
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply