Reputation: 331
I am working with an Oracle SQL Query to source some data of our Data Lake into our Business Intelligence Tool. Now I would like to add the model run date (date-time) /system date to get for every refresh the latest date. But how? Would you add a column with the date in every row? Or just one value/ row for the whole column? This would also work for me.
If so, how? The current sql query is like
"SELECT * FROM DBA.MasterData WHERE Article LIKE '%IKL%'
Upvotes: 0
Views: 392
Reputation: 231711
If you just want to add a column with the current date to the query
SELECT md.*, sysdate run_date
FROM DBA.MasterData md
WHERE md.Article LIKE '%IKL%'
Most BI tools will have the ability to run multiple queries to populate a single page of your dashboard so you could get a single run_date
rather than adding a bunch of duplicative data to your query
SELECT sysdate run_date
FROM dual
But most BI tools will have a simpler, tool-specific way to add the date the query was executed to the page since that's a pretty common request.
Are you sure that you want to use the current system date? I personally always find it more useful to use a date populated by your ETL process so that users know what time frame the data actually represents. When there are problems with an overnight load or some component that a dashboard relies on that is usually close to real-time is lagging by a few hours, that's a lot more useful than something that just blindly populates today's date.
Upvotes: 1