Probably the easiest and cleanest way is to use a transformer. Basically, you write a piece of javascript code that takes the results of both queries, merges them, and then you can pass it to your table as a data source.
To do it, on the left panel, click on "code" and then the plus symbol, and select "Transformer" from the dropdown.
Then, write the logic that will merge the queries. Something along these lines, depending on what you're trying to achieve:
const freelancers = getFreelancers.data || [];
const payments = getPayments.data || [];
// Map over each freelancer and compute their total payments
const result = freelancers.map(freelancer => {
// Filter payments that belong to the current freelancer based on matching id
const freelancerPayments = payments.filter(payment => payment.freelancer_id === freelancer.id);
// Sum the payment amounts for this freelancer
const totalPayments = freelancerPayments.reduce((sum, payment) => sum + payment.amount, 0);
// Return a new object combining freelancer details with totalPayments
return { ...freelancer, totalPayments };
});
return result;
Once you have it, on your table, just select the transformer as your data source. And that should do it.
Hope it helps.