Trying to be simple with info.\
1) I have fields in a table for bill schedules like the following
bl_start_date_24 bl_stop_date24 bl_start_date_23 bl stop_date_23 bl_start_date_22 bl_stop_date_22 etc
09-01-2023 09-01-2023 08-01-2023 08-31-2023 07-01-2023 07-31-2023
I want to be able to code something in Alteryx sql code to be similar to below but this is just logic I would like it to work.
declare bill_start_date Date value
BL_START_DATE =
IF BL_START_DATE24 < todays_date THEN BL_START_DATE24 ELSE
IF BL_START_DATE23 < todays_date THEN BL_START_DATE23 ELSE
IF BL_START_DATE23 < todays_date THEN BL_START_DATE23 ELSE
Continue thru #1
BL_STOP_DATE/A8YYMD =
IF BL_STOP_DATE24 > todays_date THEN BL_STOP_DATE24 ELSE
IF BL_STOP_DATE23 > todays_date THEN BL_STOP_DATE23 ELSE
IF BL_STOP_DATE23 > todays_date THEN BL_STOP_DATE23 ELSE
Continue thru #1
end
--the above will give me the current bill schedule dates (both start and stop in the above variables. Now I want to print.
select
acccount_number
bl_start_date
bl_stop_date
from
limit 10
_____
Can you help me to do this?
Is this In-DB?
HI,
This is not a Database or DBeaver. This is something that I want to code in SQL and paste that code into the input tab to run the query and declair the variable and do the IF THEN ELSE statements to get the output. I want to do this in Alteryx. Can you help with providing sample code in SQL to do this so that I can paste it. I prefer the sql code for declare variables as I mentioned and to use an IF THEN ELSE to find the right field in the multiple occurance of the bill schedule that I provide above. Thank you
You wouldn not use SQL in your case - you would use a formula tool to create a new field using an if/then/else/endif structure. SQL uses a CASH WHEN THEN WHEN THEN .. END structure which is not relevant if you are not using a DB.