SELECT `lq`.`createdTS`, `um`.`username`, `lq`.`type`, `lq`.`query`, `lq`.`executionTime`, `lq`.`userIP`
FROM (`_log_query` lq)
LEFT JOIN `tbl_usermaster` um ON `um`.`fldid`=`lq`.`userID`
WHERE `lq`.`createdTS` >= '2014-01-01'
AND `lq`.`createdTS` <= '2014-09-05'
AND `lq`.`companyID`  =  '15'
AND `lq`.`userID` =  '16'
AND `lq`.`type` =  'insert'