场景:选择客户后,再选择品牌,只显示客户品牌(客户定义几个品牌)
IF EXISTS (select b.Brand,b.code,cb.* from M_Tabs_CustomerBrand cb left join M_Brand b on cb.BrandID=b.BrandID where CustomerID=:CustomerID)
begin
select b.Brand,b.code,cb.* from M_Tabs_CustomerBrand cb left join M_Brand b on cb.BrandID=b.BrandID where CustomerID=:CustomerID
end
else
begin
select * from M_Brand
end