db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: How to COUNT DISTINCT over multiple columns ?
Date Sun, 18 Dec 2005 15:18:37 GMT
>>>>>>>>>>>> Thomas Dudziak wrote (2005-12-18 12:38:52):
>   SELECT COUNT(*) FROM (SELECT DISTINCT person_id, project_id FROM
> person_project);
> 
> doesn't work either, I get a
> 
>   ERROR 42X01: Syntax error: Encountered "<EOF>" at line 1, column 80.
> 
> Is there a way to achieve this with Derby ?

You're just missing a small detail:

select count(*) from (select distinct person_id, project_id from person_project) as t(a,b);

-- 
Bernt Marius Johnsen, Database Technology Group, 
Sun Microsystems, Trondheim, Norway

Mime
View raw message