Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to use a WHERE clause with an AND clause to achieve the following:
Actual Volume should only be loaded if >= 0.
No data should be loaded if Forecast and Actual both = 0.
I have tried the following but it seems to eliminate records where Forecast = 0 but Actual does not.
WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' AND [Forecast Volume]<> '0');
I'm not sure if I'm perhaps using AND incorrectly or misplacing my ().
Thanks for your help!
M
Hello,
you can take:
WHERE [Actual Volume] >='0' AND NOT ([Actual Volume] = '0' AND [Forecast Volume] = '0');
which is the same as:
WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' OR [Forecast Volume] <> '0');
Regards
Christian
Use for Actual data to be load
Load * From Source
WHERE [Actual Volume] >= 0
Or
Load * from Source
Where ([Actual Volume] <> 0 AND [Forecast Volume]<> 0);
Regards
Anand
Hello,
you can take:
WHERE [Actual Volume] >='0' AND NOT ([Actual Volume] = '0' AND [Forecast Volume] = '0');
which is the same as:
WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' OR [Forecast Volume] <> '0');
Regards
Christian
WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' is a contradiction. The first part checks for greater or equal to 0 and the secend part checks for not equal to 0. If the condition is 0 your AND cannot resolve itself.
Hi,
You can try different way also by this expression load where condition in two different table and then concatenate those
MainTable:
Load * From QVD
Where [Actual Volume] <> 0 AND [Forecast Volume]<> 0;
Concatenate
Load * From QVD
Where [Actual Volume] >=0;
Regards,
Anand
Thanks, Christian!
WHERE [Actual Volume] >='0' AND ([Actual Volume] <> '0' OR [Forecast Volume] <> '0'); seems to work as anticipated