Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
salezian
Creator
Creator

Where condition on load statement

Hi everyone

I'm trying to execute following statement:

LOAD DATEID,WORKDAY_IN_MONTH AS WDIM,LAST_WORKDAY_IN_MONTH AS LWDIM

RESIDENT D_DATE WHERE DATEID=date(now(),'YYYY-MM-DD 00:00:00');

But table is empty. Record for today date exists in table. When I change sign = to <= table is loaded with data.

1 Solution

Accepted Solutions
manojkvrajan
Luminary
Luminary

Marcin, Please try to declare in a variable and check if it works by using the variable in WHERE condition mentioned below.

LET v_LoadDate = date(now(),'YYYY-MM-DD 00:00:00');

TableA:

LOAD DATEID,

WORKDAY_IN_MONTH AS WDIM,

LAST_WORKDAY_IN_MONTH AS LWDIM

RESIDENT D_DATE

WHERE DATEID='$(v_LoadDate)';

View solution in original post

5 Replies
manojkvrajan
Luminary
Luminary

Marcin, Please try to declare in a variable and check if it works by using the variable in WHERE condition mentioned below.

LET v_LoadDate = date(now(),'YYYY-MM-DD 00:00:00');

TableA:

LOAD DATEID,

WORKDAY_IN_MONTH AS WDIM,

LAST_WORKDAY_IN_MONTH AS LWDIM

RESIDENT D_DATE

WHERE DATEID='$(v_LoadDate)';

salezian
Creator
Creator
Author

It works. Thanks. Can you explain me what is the difference between my solution and yours (except that Yours is working )

Not applicable

Dear Marcin,

Load DATEID as Daystart(DATEID) in your load statement.

Let me know if it works

Mhatim

manojkvrajan
Luminary
Luminary

Marcin, WHERE condition considers everything other than number as string. Time stamp will also be considered as string due to the spaces and special characters. Hence it is good to give within single quotes ('') or using a variable in single quotes (''). I hope this helps.

Not applicable

Brilliant post and very helpful.