HomeActive Query BuilderCan I create "SELECT count(*) FROM", by beginning with a normal query having no "count"?

Can I create "SELECT count(*) FROM", by beginning with a normal query having no "count"?


Hello,

I'm using the latest Java version of Active Query Builder.

I created a query "select id from customers where ....", and now I also want to create a query "select count(id) from customers where", and I would like to create this "count(id)" query programmatically, without clicking manually on aggregate function list, because, my final users don't know SQL and thus are unable to use these aggregate functions.

Is there anyway to create it programmatically, for example by applying setAggregateString()?

Thanks.
Rosière | email
July 30 2009, 09:39 AM
I tried this method: remove all fields from select clause, then add "id", then setAggregateString("SELECT DISTINCT").

I then tried it for Oracle and MySQL.

for example:

SELECT Count( DISTINCT language_id )
FROM ast_languages it works.
Rosière | email
1 hour, 52 mins since original post
Rosière,

All is right, but you have mistyped the aggregate string: it must be
setAggregateString("COUNT DISTINCT").
Eugene Starkov [ActiveDBSoft] | email
4 days, 20 hours since original post
This topic is closed