metamodel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kasper Sørensen <i.am.kasper.soren...@gmail.com>
Subject Re: QUESTION | Count (distinct column)
Date Tue, 27 Oct 2015 17:25:56 GMT
Hi Ankit,

Good question.

Today there's only a way to fire an _equivalent_ query using a subquery. Of
this form:

  SELECT COUNT(*) FROM (SELECT DISTINCT columnA FROM tableX)

or alternatively:

  SELECT COUNT(*) FROM (SELECT columnA FROM tableX GROUP BY columnA)

I believe that adding a count distinct function would be possible tho'.
It's just not there yet. The suggestion was registered in JIRA quite some
time ago [1], but recently we made it much easier to plug in new functions,
so now might be the time to consider adding it.

Regards,
Kasper

[1] https://issues.apache.org/jira/browse/METAMODEL-168


2015-10-27 18:05 GMT+01:00 Ankit Kumar <ak.ankitkumar@gmail.com>:

> Hi All,
>
> In the Metamodel API is it possible to write a query for the below JDBC
> query.
>
> select count(distinct columnA) from tableX ;
>
> I somehow cannot find a way to write such a query using the Query API.
>
> Am I missing something or is this something to be added in the API ?
>
> Regards
> Ankit
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message