Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
Can any one please help me on below requirement.
I have a qvd load like below. Here Month Field contains the data from Jan to Sep.
How to load only Max(Month) data dynamically instead of hard code in where condition.
Please help me on this.
Load
Month,
ID,
Salary,
Branch
From …
where Month='Sep';
Thanks in advance.
try this
MaxMonth :
Load
max(Month) as maxMonth
From …
let vMaxMonth = peek( 'maxMonth',0,'MaxMonth') ;
drop table MaxMonth ;
Load
Month,
ID,
Salary,
Branch
From …
where Month='$(vMaxMonth)';
you can't like this you shoud load data with no condition
after this load the max(month) in a variable
after this you can reload data with the condition where Month = vMaxMonth
try this
MaxMonth :
Load
max(Month) as maxMonth
From …
let vMaxMonth = peek( 'maxMonth',0,'MaxMonth') ;
drop table MaxMonth ;
Load
Month,
ID,
Salary,
Branch
From …
where Month='$(vMaxMonth)';
Thank you .. Its working
Using Max(Month) on Months that are stored as text will be difficult. You could possibly apply a mapping to the retrieved data if you want to work with Max(Month).
However, if you just want to retrieve the data of the current month, a simple:
Where Month = Month(Today());
should suffice.