View Single Post
  #2 (permalink)  
Old November 22nd, 2003, 12:42 PM
planoie's Avatar
planoie planoie is offline
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Try something like this:

SELECT MAX(itemcode) FROM tablename
GROUP BY SUBSTRING(itemcode, 0, 5)

Your syntax may vary depending on your DB platform. The important part is that you need to group by the desired portion of the field using the appropriate sub string syntax.

Peter
------------------------------------------------------
Work smarter, not harder.
Reply With Quote