Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Coding puzzle

$
0
0

Hi all, I think this should be simple but I'm having trouble - can't get my head round the various options.

Basically I need a list of which Reports are being run - the last run date and the user who ran it. I have two tables - one contains the Report name and the other has the User ID and Run Date.

So far my code gives me a uasable table but contains the last run date for all report/user combinations whereas I need simply the reports "grouped" and name of the user who last ran it. Here is the code - what am I missing?

SELECT distinct VALORE as 'Report Code'
      ,UTENTE as 'User'
      ,max(convert(date,OP_TIME,3))as 'Last Run Date'
FROM REP_AUDIT_PARAMETRI_DIM ,REP_AUDIT_OPERAZIONE
Where CODICE_DIMENSIONE = 'REPORT'
  AND OP_TIME > '2012-12-31 00:00:00.000'
  and REP_AUDIT_OPERAZIONE_OID=OID
group by  VALORE,UTENTE


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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