我想在laravel/php中编写一个SQL查询,以获取客户购买的前10个不同的产品。
我的表结构如下:
Orders表(客户ID、产品ID等等...)Products表(产品ID、产品名称等等...)这是我的查询尝试:
SELECT products.*
FROM products
WHERE products.id = [SELECT DISTINCT (products.id)
FROM orders
WHERE customer.id=id->list(10)] Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号