![]() ![]() Second, we've included two components in our FROM clause. Let's take a few moments to explain what we've done.įirst, we've aliased the first instance of the report_history table as rh. WHERE rh.report_name = maxresults.report_nameĪND rh.report_run_date= maxresults.maxdate (SELECT MAX(report_run_date) AS maxdate, report_name ![]() The SQL SELECT statement below will return the results that you want: SELECT rh.user_name, rh.report_name, rh.report_run_date I don't want that.I just want to know who ran a particular report the last time it was run.Īnswer: This is where things get a bit complicated. User1 ran Report 1 on 01-JUL-03, User2 ran Report1 on 01-AUG-03). However, it does not provide the name of the user who ran the report.Īdding user_name to both the select list and to the group by clause returns multiple lines for each report the results show the last time each person ran each report in question. My initial query: SELECT report_name, MAX(report_run_date) What I am trying to do is pull from this table when the last time each distinct report was run and who ran it last. ![]() To simplify, let's say the table (report_history) has 4 columns: user_name, report_job_id, report_name, and report_run_date.Įach time a report is run in Oracle, a record is written to this table noting the above info. Question: I'm trying to pull some info out of a table. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |