Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please help on a sql query

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got stuck one sql query. Say, we have a table:


Now I want to pull out each category's lattest one. Therefore, the result should be


Any hints / solution ?

Thanks.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edward,
You can use a nested query to get the primary key for the maximum of each category. "group by" lets you group by category name. Then you can get the values for that primary key.

Give it a shot and then we can tweak the SQL here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic