Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I am having some problems to use the max() function in the script, in the frontend it works.
I am trying to find my maximu !m value of the field SCFI date. I have already formated a newly generated field which shows the dates numerical. But there is still an issue with calculating the maximum.
max(SCFI_date_num) as SCFI_Max
The script generator stops with the hint:"Invalid expression", which is totaly nonsense... why should the max() function does not work anymore?
Any help really appreciated.
Chris
Now that I think about it, you're always using a GROUP BY clause, whether explicitly specified or implied. In the second case, the implied clause is something like:
LOAD Max() AS MaxField
FROM ...
GROUP BY Nothing;
which of course isn't valid script syntax.
max will work with group by
chk sample
May be try this
Table:
LOAD *
FROM [Test.qvd] (qvd);
Left Join (Table)
LOAD Max(SCFI_date_num) as SCFI_Max
Resident Table;
Max() is an aggregation function. It aggregates values from multiple records into a single value.
You can use Max() in a load script in two ways:
In your case, the Max() function will be accepted if you omit the *, part.
You must load all fields, after, concatenate your specific field with expressions, etc
As in the attached file
Now that I think about it, you're always using a GROUP BY clause, whether explicitly specified or implied. In the second case, the implied clause is something like:
LOAD Max() AS MaxField
FROM ...
GROUP BY Nothing;
which of course isn't valid script syntax.
Thank you all, I know now what my mistake was (the missing group by). My solution to this is, to load the max value in a second load, as described by Sunny, but without joining it in the end.