Avatar of kevin1983
Flag for United Kingdom of Great Britain and Northern Ireland asked on

SQL select code to show records with highest Delivery number

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]
  FROM [LiveDB].[dbo].[View_Driver]
Microsoft SQL Server 2008Databases

Avatar of undefined
Last Comment

8/22/2022 - Mon
Jim Horn

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

great, Thanks  jimhorn and the recommendation on the address field
Jim Horn

Thanks for the grade.  Good luck with your project.  -Jim

Thanks, I had a little search on-line for reserved t-sql keywords but couldn't see address listed unless the lists I found were not up to date and address is a more recent word?.

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck