like-gold
like-gold7mo ago

How to connect two select queries?

I have done the following: meta: { select: "*, countries(name, formula) as parcels.destination_country, customers(name) as parcels.sender" } Bu these queries together do not work, which operator / keyword am I missing?
2 Replies
kapa.ai
kapa.ai7mo ago
Hi @3d.2478. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- In refine, when using Supabase as your data provider, you can use the select value in the meta object to perform relational database operations. However, the provided extracts do not contain a specific example of joining countries and customers in the way you're trying to do. Here's a general example of how you might structure your select statement:
const { tableProps, sorter } = useTable<IResource>({
resource: "resourceName",
meta: {
select: "*, countries(*), customers(*)",
},
});
const { tableProps, sorter } = useTable<IResource>({
resource: "resourceName",
meta: {
select: "*, countries(*), customers(*)",
},
});
In this example, resourceName is the main resource, and we're joining on countries and customers. The (*) after each resource indicates that we want to select all fields from those resources. You would replace resourceName, countries, and customers with the actual names of your resources. Please note that this is a general example and might need to be adjusted according to your specific use case and data structure. For more complex joins or queries, you might need to adjust the select value accordingly. For more information, you can refer to the Supabase documentation (https://supabase.io/docs/reference/javascript/select) on how to structure select statements for joins. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@326362244860346371> kapa.ai is still learning and improving, please let us know how it did by reacting below