Group by child tables

Options

I have two tables, profile and company, and I do a left join in a Query All step has some profiles may not have a company. The company table has attributes like company_size. I want to provide a result that aggregates the # of profiles by the company attributes like:

{

company_size: {

"1-10": 33,

"11-50": 63

}

}

They "key" is from the company table and the "value" is the # of profile records. It seems like the aggregate feature (either addons or queries) can only use one table at a time or am I missing something?

Best Answer

  • wrollo
    wrollo Member
    Answer ✓
    Options

    Hello Liz,

    Thank you, it appears the Evals work fine for this in the aggregate logic. Thx.

Answers

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    Hi @wrollo! 👋

    Welcome to the Xano Community! 🎉

    You can use the aggregate feature on multiple tables at one time. You would join your tables, then create Evals for whichever fields from those joined tables you care about. These fields will then be available in the Aggregate options.

    You can Aggregate data in Addons as well. The documentation here provides an example of how to do an Addon that returns the data using the aggregate feature using two tables.

    I hope this helps! Let us know if you have any additional questions!