Date time now in SQL EDITOR
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I need help! this is in SQL EDITOR
- Ref Date should be the day the report is generated
For ex. I have the column CFG_STAT that will populating a months worth data like 4/13/2023 (it is manual now) I have to change the date each time and then the ref date should be THIS date BUT dynamically each time the report is run.
Also, how do I change the column CFG_STAT to retrieve 1 month data every time as well.
how do I do this?
thanks
Solved! Go to Solution.
- Labels:
- Reporting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi @Hi2023 , I think it depends on the database you are connected to. For most SQL Servers GETDATE() will work, for a MySQL Server you might need to use CURDATE()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks that what I was just thinking -
what bout pulling one month data every time it is run for the column referenced?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
does this look right for pulling previous one month data ??
DateTimeFormat(CRG_STAT) >= DateTimeFormat(DateTimeAdd(DateTimeNow(), -1, "month"))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
are you on mysql? Are you in-db? In-db follows server syntax - and fields are labeled as "fieldname" vs [fieldname]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
hmmm I am using the SQL EDITOR in Alteryx?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
That uses "fieldname" - but also - are you on mysql? you have to use the proper SQL functions for your database.
