Hi fahmi, could elaborate a little bit? I'm not sure if I got your need.
If you want to use the agregate functions inside an advanced query, you can use them just as you would use directly on the database, for example, sum(yourfield).
João Melo wrote:
i mean, when i want to show the sum of category that posted in posting entity (category entity related with posting entity), so how to write the code ? can you show me an example of advanced SQL for it ?
fahmi fachrurozi wrote:
hi is this the same?
https://www.outsystems.com/forums/discussion/29731/how-to-count-like-based-on-postingid/
regards,
bb
Hi Fahmi,
It seems your question is more about "how do I do SQL" than "how do I do this with the OutSystems Platform". However, the Platform has a very powerful feature called Aggregates that allow you to sum as well. Looking at the SQL you posted, there's nothing in there that can't be done with an Aggregate. Check the documentation for more information.
Barong Bali wrote:
yes that is.
i have this error, what i have to do ?
hi,
is that the query that causes error? Why there is no group by clause?
Use Aggregate with advantage it is database-independent, instead of using advanced SQL. Use advanced SQL if aggregate cannot do it, for example when you delete bulk of records. Here using agregate to count Id:
- group by id
- aggegrate function: count
Fahmi,
You seem to have problems with writing basic SQL. I would really advice you to abandon that track, and like I said before, and Barong is now saying (and showing!) as well, please use Aggregates.
Kilian Hekhuis wrote:
ok, thank for you guys, Kilian and Barong. So, if i want to make the aggregate function, i have to make it first in table and view data and then choose the action on top of table, right ? i got it
How to fix this error ?
Well, you're still not using an Aggregate. Go use an Aggregate.