Shiji
Shiji

Reputation: 1

Please help me with SQL Select Query

Depreciation table

enter image description here

Attached image is my depreciation table. From this ,I want an SQL Query which returns all asset tags with maximum depr_date. that means asset tag with last depreciation date.

I want something like this

asset_tag    depr_date
----------------------
TB29         2015-04-11
TB30         2015-03-11
PC626        2015-04-10

Upvotes: 0

Views: 174

Answers (1)

Kapil Jain
Kapil Jain

Reputation: 188

Try below one.

SELECT asset_tag, max(depr_date) 
FROM table 
GROUP BY asset_tag

Upvotes: 2

Related Questions