Hi Jedi
The Simple Leave App in Joget Workflow Marketplace has a lot of examples you can explore for working JDBC SQL query (for example below in the app's 'My Leave Entitlements' list). Do download the many apps in Joget Workflow Marketplace to learn programming tips and techniques.
SELECT a.id AS id,
a.c_entleavetype AS LeaveType,
( a.c_entleavebaldays - a.c_entleavefloat ) AS LeaveBalance,
a.c_entleaveyear AS Year,
a.c_entleaveentitledays AS LeaveEntitleDays
FROM app_fd_j_leave_ent_type a
INNER JOIN app_fd_j_leave_ent b
ON ( a.c_appid = b.id )
WHERE ( b.id = '#currentUser.username#' )
ORDER BY a.c_entleaveyear DESC,
a.c_entleavetype ASC