SELECT `a`.*, `b`.*, `c`.`fldcurr_code` as currency, concat(a.formNo, "[", lpad(a.serialNo, 8, "0"), "]") as otherPaymentNo
FROM (`comp_payment_others` a)
LEFT OUTER JOIN `comp_payment_others_without_item` b ON `b`.`otherPaymentID` = `a`.`ID`
LEFT OUTER JOIN `_ref_currency` c ON `c`.`fldid` = `a`.`currencyID`
WHERE `is_delete` =  0
AND `a`.`ID` =  'undefinedusersetting'
AND `a`.`otherPaymentType` =  1
AND `a`.`companyID` =  '3'