I am trying to CONCAT a String and a Modified date format. I have two requirements
First one, I need the output to be in the output window be like
- Cost Month: Month YYYY format( where month should be previous month only). for ex-
Cost Month: March 2022
- Report Date: MM/DD/YYYY(Todays current date)
Report Date: 04/20/2022
For the second requirement, I am trying something like
SELECT CONCAT ('Report Date' , 'SELECT CURRENT_DATE(FORMAT 'mm/dd/yyyy') (vARCHAR(12))') as Report_Date
But ofcourse it isn't working
CodePudding user response:
You're close:
CONCAT ('Report Date: ' , (CURRENT_DATE (FORMAT 'mm/dd/yyyy')) ) as Report_Date
Similar for cost month (using ||
instead of CONCAT):
'Cost Month: ' || (add_months(current_date, -1) (FORMAT 'mmmmByyyy'))