0

I can use following query in ms access.

SELECT DISTINCT JobCardNo, custnm
FROM            JobCardDetails
ORDER BY JobCardNo DESC

the output is

JobcardNo CustNm
189        sagar
188        sagar
187        shiva

but i want output like

JobcardNo CustNm
189        sagar
187        shiva
Pred
  • 8,789
  • 3
  • 26
  • 46
Shilvant
  • 13
  • 4
  • don't include tags in title, rather use a proper question tag. – Rahul Sep 29 '15 at 12:00
  • possible duplicate of [Getting a distinct value across 2 union sql server tables](http://stackoverflow.com/questions/1891016/getting-a-distinct-value-across-2-union-sql-server-tables) – JoeG Sep 29 '15 at 12:42
  • but i want to get all record in 1 table – Shilvant Sep 29 '15 at 13:21
  • Please use the [formatting features](http://stackoverflow.com/help/formatting) in the future. I did some formatting for now. – Pred Sep 29 '15 at 13:47

1 Answers1

1

You are just looking for the MAX(JobCardNo) for each custnm:

select MAX(JobCardNo) as JobCardNo, custnm 
FROM JobCardDetails 
GROUP BY custnm
ORDER BY JobCardNo DESC
Sam Cohen-Devries
  • 2,025
  • 2
  • 18
  • 35