Fix application count query not containing AP_APP_RELEASE columns when filtering

Fix inaccurate application count when an appliction has more than 1 release
feature/traccar-sync
Mohamed Rashd 3 years ago
parent 097423b2b0
commit 986828bc16

@ -260,8 +260,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
String sql = "SELECT count(AP_APP.ID) AS APP_COUNT "
String sql = "SELECT count(DISTINCT AP_APP.ID) AS APP_COUNT "
+ "FROM AP_APP "
+ "LEFT JOIN AP_APP_RELEASE ON "
+ "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID "
+ "INNER JOIN (SELECT ID FROM AP_APP) AS app_data ON app_data.ID = AP_APP.ID "
+ "WHERE AP_APP.TENANT_ID = ?";
if (filter == null) {

Loading…
Cancel
Save