select ci.CabIID,ci.CabTitle,ro.RoomName,hal.HallName,kc.KitchenName
from CabInfo as ci left join Room as ro on ro.RoomID=ci.RoomID
left join Hall as hal on hal.HallID=ci.HallID
left join Kitchen as kc on kc.KitchenID=ci.KitchenID
-----------------------
上面这样子对的。是可以查出来的
use zgwpjh
go
select
b.catename,b.catecode,count(物品类别) as total
from products a inner join category b
on substring(a.物品类别,1,4)=b.catecode
inner join
用户 c on a.物品主人=c.用户名
where a.物品名称 like '%花%' and substring(a.物品类别,1,4)='1001'
and c.省份='山东' and c.城市='日照市'
group by a.物品类别,b.catename,b.catecode
order by total desc