Left join with JSON

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.
image.png
Was this page helpful?