fweigl
fweigl

Reputation: 22028

DBFlow 'count as'

I want to execute the following statement in DBFlow:

SELECT SECTION_ID, COUNT(SECTION_ID) AS SECTION_COUNT FROM ARTICLES GROUP BY SECTION_ID ORDER BY SECTION_COUNT DESC

What I tried is:

Select(Article_Table.sectionId).from(Article.java).count(???) ...

The Flow object has a count()method but it takes a DatabaseWrapper as an argument which I frankly don't understand, I would have expected it to take a Table Column (i.e. Property).

Any ideas how I can do this?

Upvotes: 2

Views: 809

Answers (1)

Christian Green
Christian Green

Reputation: 97

You need to add

Method.count() 

inside your Select() statement

Example: Select(Method.count()).from(Article.class).count();

Upvotes: 5

Related Questions