troubleshooting Question

SQL select code to show records with highest Delivery number

Avatar of kevin1983
kevin1983Flag for United Kingdom of Great Britain and Northern Ireland asked on
DatabasesMicrosoft SQL Server 2008
4 Comments1 Solution491 ViewsLast Modified:
Hi,
I have the below basic sql select code but id like to only display the highest DeliveryNum records related to the the DocNum in the results. Ie only the DocNum line with the highest DeliveryNum number record shown

For example at the moment the results show 2 records both with Docnum 46182 and one record with DeliveryNum 2309 and the other record with 2320, but id like the results to only show one line with the delivery number: 2320

Is this possible?


SELECT [TrgetEntry]
      ,[DocEntry]
      ,[DocNum]
      ,[NumAtCard]
      ,[DeliveryNum]
      ,[CardCode]
      ,[ShipToCode]
      ,[Address]
      ,[SalesDocDelivery]
  FROM [LiveDB].[dbo].[View_Driver]
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros