View Single Post

   
  #3 (permalink)  
Old 04-20-2008, 10:03 AM
bozon
 
Posts: n/a
Default Re: Having problem with distinct and count

create view stupid_results_view(sTupid) as select name || number from
results ;

select * from stupid_results_view ;

select count(distinct sTupid) from stupid_results_view ;

stupid test11

stupid test11

stupid test11

stupid test22

stupid test22

stupid test22


(count)

2
Table and column names reflect my opinion of the way this is
implemented in Informix. I am pretty sure other databases allow
calculations in the count() function or multiple columns but you have
to work around a syntax limitation in informix. I don't think this will
be really fast unless you use functional indexes and informix can
figure out that is what you are trying to do. PS. I am almost certainly
not handling nulls the way that you would want.

Reply With Quote