How can I select max column value which returns 0
when no rows matching condition and returns null
when any row contains the column with null
value
For example:
SELECT MAX(groupId) from Interview WHERE appId= 61
When no rows present matching this condition or when there are rows with groupId=null
, it returns
0
- when queryForInt()
, null
- when queryForList()
and get the first entry.
Please let me know, either query change or Hibernate method.