Mysql subquery error

Sub Query wont work, syntax error. “(select count(1) from counter_employee ce where ce.empid = em.empid and ce.type=2) as totalcounter” however “select 1 from dual” is working for GridConnector.

The same query running using mysql console is working perfectly.

Help!

$query = "select em.*, ".
         //"(select 1 from dual) as totalcounter " .
         "(select count(1) from counter_employee ce where ce.empid = em.empid and ce.type=2) as totalcounter ".
        "from employee_master em where em.emptype=".EMPTYPE_MAS_SPC.
			" and em.status in (".STATUS_ACTIVE.",".STATUS_INACTIVE.")";

$res=mysql_connect(MySQL_DB_HOST,MySQL_DB_USER,MySQL_DB_PASSWORD,false); //<-- fails here with 500 status code returned.
mysql_select_db(MySQL_DB_NAME);
$grid = new GridConnector($res,“MySQL”);

$grid->render_sql($query, "empid", "1,empcode, empname, status, empid");

Try to update connector package and use

$grid->render_complex_sql($query, "empid", "1,empcode, empname, status, empid");

Updated connector’s package is attached.
codebase_connector_1011.zip (57.3 KB)