
Sorry, wrong syntax indeed. It is much simpler:
select *
from my_func( (select distinct value1,value2 from table) );
On 9 June 2016 at 15:58, Stefano Fioravanzo
Roberto,
Yes you are right, I expressed myself wrong. What you suggested is exactly what I need, but it gives me an error.
syntax error, unexpected FROM, expecting UNION or EXCEPT or INTERSECT or ‘)'
The double from is suspicious, was it intended?
Stefano
On 09 Jun 2016, at 15:32, Roberto Cornacchia
wrote: Stefano,
What you wrote does not look like an aggregation.
This is an aggregation: you make groups on value1,value2, and for each group you aggregate values (e.g. value3,value4).
select value1, value2, my_aggr_function(value3, value4) from table group by value1, value2
However, if that returns more than one tuple per group, it's again not an aggregation.
I have the impression that what you are looking for is: for every tuple (which might come from a previous aggregation), return a table, and concatenate the results. This would look like:
select * from ( (select * from my_func(x.value1, x.value2) from (select distinct value1,value2 from table) as x) );
This is possible in MonetDB. It will make a table out of each distinct (value1,value2) pair, and give you back the concatenation of all results (mind the double parentheses in the from clause, they are needed).
I have done this and works well.
Roberto
On 9 June 2016 at 15:18, Stefano Fioravanzo
wrote: Hello,
I have an embedded python function which, given two integer parameters, after doing some stuff returns a table. I would like to group by a table by these two input parameter, and for each resulting group call the function. The result would be the concatenation of all the tables returned by the function.
I understand that a thing like this would be very easy if the function returned just one value e.g.: select my_aggr_function(value1, value2) from table group by value1, value2
But how can I do this if my_aggr_function returns multiple rows??
Thank you,
Stefano _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list