我有sql查询,这必须是快速工作这是我的第一个查询,对于我要做的事情来说,这个查询非常慢distinct symbol as s=0) as a
,(select count(distinct login) from orders dd where symbol=s and (select sum(volume) from orders,"GBPUSD","USDJPY","USDT
下面的查询几乎给出了正确的计数,但它包括了包含重复p.promo_code值和子缓和值的行。我如何让这个查询使用不同的p.promo_code,submitid?我尝试了几种解决方案,因此对于单个连接查询,例如-- the sum * COUNT(DISTINCT p.promo_code,submitid)/count(*)SELECT
SUM(CASE WHEN ISNULL(p.promo_code)
在具有聚合函数的简单查询中,DISTINCT是否有任何效果?select DISTINCT salesperson, SUM(sales_amt) from sales GROUP BY salespersonselect salesperson, SUM(DISTINCT sales_amt) from sales GROUP BY salesperson
(平