Mysql 子查询-仅使用一个Where语句

Mysql 子查询-仅使用一个Where语句,mysql,subquery,Mysql,Subquery,我有下面的查询,每次我更改它,我都需要更改stockclientid。我希望它只适用于所有子查询的一个where语句 是否还有一种方法可以应用相同的代码返回多行?我希望显示所有StockClientId的结果,而不仅仅是1个 Select (Select distinct SName FROM classifiedadmin.readOnly_CoreData) as SupplierName, (SELECT COUNT(*) FROM classifiedadmin.readOnly_

我有下面的查询,每次我更改它,我都需要更改stockclientid。我希望它只适用于所有子查询的一个where语句

是否还有一种方法可以应用相同的代码返回多行?我希望显示所有StockClientId的结果,而不仅仅是1个

Select 

(Select distinct SName FROM classifiedadmin.readOnly_CoreData) as SupplierName,

(SELECT COUNT(*) FROM classifiedadmin.readOnly_CoreData where Successful= 1 and StockClientID=3) as TotalLive,

(Select count(*) FROM classifiedadmin.readOnly_CoreData where length(DetailDesc) > 200 and StockClientID= 3) as DescriptionOver200,

(select count(*) from classifiedadmin.readOnly_CoreData where busruleViolated=1 and StockClientID = 3) as BusinessRuleViolated,

(Select count(*) FROM classifiedadmin.readOnly_CoreData where StockClientID = 3
and Successful=0
and busruleviolated=0
and Edition not like '%auto%'
and Edition not like '%shift%'
and Edition not like '%tronic%'
and Edition not like '%van%'
and Edition not like '%DSG%') as UnadvertisedManual;
请注意,如果给定的
stockclientid
中有多个
sname
,则当前使用
SELECT disect sname
进行的查询将失败

SELECT  MIN(sname),
        SUM(Successful= 1),
        SUM(length(DetailDesc) > 200),
        SUM(busruleViolated=1),
        SUM(
        Successful=0
        and busruleviolated=0
        and Edition not like '%auto%'
        and Edition not like '%shift%'
        and Edition not like '%tronic%'
        and Edition not like '%van%'
        and Edition not like '%DSG%'
        )
FROM    classifiedadmin.readOnly_CoreData
WHERE   StockClientID = 3