请教informix的distinct
一是多列distinct:如select distinct(c1,c2) from table,报语法错误,SQL Error (-201) : A syntax error has occurred. 用unique也不行,搞的我只好distinct(c1 || c2)这样,请教原因
二是没法count(distinct)
select distinct(c1) from table可以,然后我count(distinct(c1))就报语法错误,总不能让我导出来再count(*)吧,请教原因
[ 本帖最后由 xlife 于 2007-7-2 11:16 编辑 ] 试出来了,原来distinct多列不能用(),一列可用(),但count时又不能用,informix真不规范,但现在仍有个问题,就是count(distinct c1,c2)时仍报错,用不用()都一样,请教大家如何count(distinct 多列)的? select count(distinct a || b || c)
如果要考虑对齐,可以加入count(distinct a || ’$$$$' || b || '$$$$$' || c) 定界,你可以选择一个
字段里面不会出现的字符。
页:
[1]