1、
SELECT g.`name`,DISTINCT(s.goods_id) from shoppinglist s,goods g
WHERE s.goods_id=g.id
错误
正确是:
SELECT DISTINCT(s.goods_id),g.`name` from shoppinglist s,goods g
WHERE s.goods_id=g.id
2、
select c.`name`,g.`name`, FORMAT(s.number/g.unit_price , 2)from customer c,shoppinglist s,goods g
where c.id=s.customer_id and s.goods_id=g.id
3、
SELECT * from customer c where c.date>‘2012-11-1‘ order by c.id asc
4、
SELECT c.`name` from customer c,shoppinglist s where c.id=s.customer_id GROUP BY s.customer_id
HAVING sum(s.number)>=50
时间: 2024-10-03 21:07:33