日期:2014-05-18  浏览次数:20587 次

统计并过滤重复记录怎么写
select   count(csl_orders_goods)   as   idcount   from   (select   distinct(csl_orders_goods)   from   chinashowlace_orders   where   csl_orders_userid= "&session( "csl_user_id ")& ")
我现在有统计应该有三条记录为什么没呢

------解决方案--------------------
try

select count(distinct csl_orders_goods) as idcount from chinashowlace_orders where csl_orders_userid= "&session( "csl_user_id ")& "
------解决方案--------------------
select count(csl_orders_goods) as idcount from
(
select distinct(csl_orders_goods) as csl_orders_goods from chinashowlace_orders where csl_orders_userid = "&session( "csl_user_id ")& " --这里加入变量
) t

------解决方案--------------------
子查询要有别名的,没有别名能运行??