SQL Inner join error

Question:
What I’m I missing here?

Product:
Studio Editor

Here’s my collections:
image

export async function test() {
    try {
        const results = await sql(
            'SELECT collection1.team FROM collection1 INNER JOIN collection2 ON collection1.team = collection2.team',
            
        );
        return results.payload.data.rows;
    } catch (error) {
        console.error(error);
    }
}```

Error: Cannot read properties of undefined (reading 'map')

WixData is not SQL database it’s NoSQL database built top of MongoDB and sql package you are using is just converting SQL language into wixData APIs anything that won’t work with wixData APIs won’t work with this too.

You are using text fields to reference items this is not how things works in wixData. You can’t do this, you shoud use reference fields to JOIN collections together.

If you need SQL database consider using external solutions like Supabase PostgreSQL, Goolge Cloud SQL or AWS’s SQL database options or anything else.

You may also use Firebase Connect but it’s not available to everyone right now as I know.