Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

sql syntax to display last print date for each document type?

$
0
0

Hello sql gurus,

I need some help, this is what I am trying to accomplish:

Get the most recent DATE_PRINTED for each DOCTYPE (LE or CD) for each ACCOUNT_ID. These columns are on a table called dbo.CFPB_DELIVERY.

The sample below represents just one ACCOUNT_ID, each ACCOUNT_ID obviously has different amounts of printed DOCTYPE so this one has 3 LE's but another might have 10 LE's; the same goes for the CD.

Text
ACCOUNT_ID DATE_PRINTED DOCTYPE 00870AB7-BE8F-4782-8840-0A3488B68400 01/24/17 LE 00870AB7-BE8F-4782-8840-0A3488B68400 02/27/17 LE 00870AB7-BE8F-4782-8840-0A3488B68400 02/27/17 LE 00870AB7-BE8F-4782-8840-0A3488B68400 02/28/17 CD 00870AB7-BE8F-4782-8840-0A3488B68400 02/28/17 CD 00870AB7-BE8F-4782-8840-0A3488B68400 02/28/17 CD 00870AB7-BE8F-4782-8840-0A3488B68400 02/28/17 CD 00870AB7-BE8F-4782-8840-0A3488B68400 02/28/17 CD...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>