select c.brand as 品牌,c.title as 商品名称, a.selldate as 出库日期,a.num as 数量,a.price as 单价,a.num*a.price as 总金额, b.name as 会员,a.re as 备注 from sell a left join huiyuan b on a.id_huiyuan=b.id left join product c on a.id_product=c.id
select brand as 品牌,title as 商品名称,selldate as 出库日期,num as 数量, price as 单价,num*price as 总金额,name as 会员,re as 备注 from sell,huiyuan,product where sell.id_product=product.id and sell.id_huiyuan=huiyuan.id
select a.brand as 品牌, a.title as 商品名称 , b.num as 数量, b.price as 单价, (b.num * b.price) as 总金额, c.huiyuan as 会员, b.re as 备注 from product a , sell b , huiyuan c where a.id = b.id_product and c.id = b.id_huiyuan
select brand as 品牌,title as 商品名称,selldate as 出库日期,num as 数量,price as 单价,sum(price) as 总金额,name as 会员,re as 备注 from sell inner join huiyuan a on id_huiyuan=a.id inner join product b on id_product=b.id --按这个要求来查是不能分组的,实在要分组 直接聚合分组条件就好了
select brand as 品牌,title as 商品名称,selldate as 出库日期,num as 数量,price as 单价,price*num as 总金额,name as 会员,re as 备注 from sell inner join huiyuan a on id_huiyuan=a.id inner join product b on id_product=b.id --按这个要求来查是不能分组的,实在要分组 直接聚合分组条件就好了
a.selldate as 出库日期,a.num as 数量,a.price as 单价,a.num*a.price as 总金额,
b.name as 会员,a.re as 备注
from sell a
left join huiyuan b on a.id_huiyuan=b.id
left join product c on a.id_product=c.id
price as 单价,num*price as 总金额,name as 会员,re as 备注
from sell,huiyuan,product
where sell.id_product=product.id and sell.id_huiyuan=huiyuan.id
select
a.brand as 品牌,
a.title as 商品名称 ,
b.num as 数量,
b.price as 单价,
(b.num * b.price) as 总金额,
c.huiyuan as 会员,
b.re as 备注
from product a , sell b , huiyuan c where
a.id = b.id_product and c.id = b.id_huiyuan
select brand as 品牌,title as 商品名称,selldate as 出库日期,num as 数量,price as 单价,sum(price) as 总金额,name as 会员,re as 备注 from sell
inner join huiyuan a on id_huiyuan=a.id
inner join product b on id_product=b.id
--按这个要求来查是不能分组的,实在要分组 直接聚合分组条件就好了
select brand as 品牌,title as 商品名称,selldate as 出库日期,num as 数量,price as 单价,price*num as 总金额,name as 会员,re as 备注 from sell
inner join huiyuan a on id_huiyuan=a.id
inner join product b on id_product=b.id
--按这个要求来查是不能分组的,实在要分组 直接聚合分组条件就好了
from sell,huiyuan,product
就相当与内连接吧