I have a table storing transaction called TRANSFER . I needed to write a query to return only the newest entry of transaction for the given stock tag (which is a unique key to identify the material) so i used the following query
SELECT a.TRANSFER_ID
     , a.TRANSFER_DATE
     , a.ASSET_CATEGORY_ID
     , a.ASSET_ID
     , a.TRANSFER_FROM_ID
     , a.TRANSFER_TO_ID
     , a.STOCK_TAG
 FROM TRANSFER a
INNER JOIN (
              SELECT STOCK_TAG
                   , MAX(TRANSFER_DATE) maxDATE
                FROM TRANSFER
               GROUP BY STOCK_TAG
            ) b
   ON a.STOCK_TAG = b.STOCK_TAG AND
      a.Transfer_Date =b.maxDATE
But i end with a problem where when more than one transfer happens on the same transfer date it returns all the row where as i need only the latest . how can i get the latest row?
edited:
transfer_id   transfer_date   asset_category_id  asset_id   stock_tag 
 1               24/12/2010      100               111         2000
 2               24/12/2011      100               111         2000