Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Active Object : How to use group function of Query?

Kamlesh Kanazariya
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 15, 2016

Suppose I have ISSUE_MASTER table of Issue.

ISSUE_MASTER  Table contains ISSUE_ID,ISSUE_TYPE,PROJECT_ID etc.. columns.

Now I want to count number of issue for every project.

I have tried below codes.

Query query = Query.select("project_id").group("project_id");
Object[] qtmIssueEntity = activeObjects.find(QTMIssueEntity.class, query);

 above code failed as I got below exception.

org.h2.jdbc.JdbcSQLException: Column "ACTION_STEP_TYPE" must be in the GROUP BY list; SQL statement:
SELECT ACTION_STEP_TYPE,PROJECT_ID,CREATED_ON,CREATED_BY,PLATFORM,ISSUE_DETAILS,COMPLETE,LAST_UPDATED_BY,TEST_RUN_STATUS,ISSUE_TYPE,ISSUE_KEY,LAST_UPDATED_ON,ISSUE_ID FROM PUBLIC.AO_77491B_ISSUE_MASTER WHERE issue_type = ? GROUP BY project_id [90016-185]


I can't understood why all Column selected inside sql query even though I written Query.select("project_id").

 

I have also tried below thing.

Object[] qtmIssueEntity = activeObjects.findWithSQL(QTMIssueEntity.class, "PROJECT_ID", "SELECT PROJECT_ID,COUNT(*) as created_on FROM PUBLIC.AO_77491B_ISSUE_MASTER GROUP BY PROJECT_ID");
Object[] qtmIssueEntity = activeObjects.find(QTMIssueEntity.class, query);

In above How to get count of issue.

 



 

 

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Ramarao Gaggara {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 21, 2019

Have you ever solved this?

0 votes
Mats Stijlaart
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 17, 2016

Have you ever solved this?

TAGS
AUG Leaders

Atlassian Community Events