Left join with JSON

Ccoldhands4/3/2023
I'm using PlanetScale (MySQL) and have 2 tables: orders and products.
Every order contains basic info about the ordered products (see screenshot).

Is there a way to do this?:
import { orders, products } from '$lib/server/db/schemas/products';

db
    .select()
    .from(orders)
    .leftJoin(products, inArray(products.id, /*orders.products.map(({ id }) => id)*/)),

I would like it take the ids from the orders.products array and select those products.
Bbloberenober4/3/2023
Can you build this query in raw SQL?
Ccoldhands4/3/2023
No, not really, i'm a beginner. I tried searching for this but I don't know how to put it to words. Chat gpt tried helping and came up with this. Is this any accurate? I need at least a phrase which I can google to learn this.
Bbloberenober4/3/2023
Uhh, honestly I'm not sure either, I'm not very good with JSON functions
Bbloberenober4/3/2023
You might read about using the JSON functions in your dialect in general, maybe you'll find some references
Ccoldhands4/3/2023
Okay thank you