Count on one Column Server side
Count on one Column Server side
Hello,
i'm using Server Side Processing an i would like to Count the rows in one Column the other Columns are aggregated in a Group by clause. When i enable echo $sql in my ssp.class.php the SQLString is exactly the same as the working Query on the Database, But as Result i get 'null'
here is my columns array
$columns = array(
array( 'db' => 'EVUSER', 'dt' => 'EVUSER' ),
array( 'db' => 'FullName', 'dt' => 'FullName' ),
array( 'db' => 'Dienststelle_Text', 'dt' => 'Dienststelle_Text' ),
array( 'db' => 'Teileinheit_Text', 'dt' => 'Teileinheit_Text' ),
array( 'db' => 'Liegenschaft_Text', 'dt' => 'Liegenschaft_Text' ),
array( 'db' => 'Standort', 'dt' => 'Standort' ),
array( 'db' => 'ORGID', 'dt' => 'ORGID' ),
array( 'db' => 'Count(EVINFO) as Anzahl', 'dt' => 'Anzahl' ),
);
and here ist the datatbles code
`var table = $('#EXPUSR').DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"url": "scripts/SSP_xxx.php",
"type": "POST",
"data": { whereAll: "<?php echo $SQLString; ?>"}
},
"columns": [
{ "data": "EVUSER", title: "PKennung" },
{ "data": "FullName", title: "Benutzername" },
{ "data": "Dienststelle_Text", title: "Dienststelle" },
{ "data": "Teileinheit_Text", title: "Teileinheit" },
{ "data": "Liegenschaft_Text", title: "Liegenschaft" },
{ "data": "Standort", title: "Standort" },
{ "data": "ORGID", title: "OrgID" },
{ "data": "Anzahl", title: "Anzahl" },
],
} );
});`
the resulting query looks like: SELECT DISTINCT EVUSER, FullName, Dienststelle_Text, Teileinheit_Text, Liegenschaft_Text, Standort, ORGID, Count(EVINFO) as Anzahl FROM Database WHERE EVTIME BETWEEN '2016-07-02 00:00:00' and '2016-11-02 23:59:59' AND (EVTYPE =278) Group by EVUSER, FullName, Dienststelle_Text, Teileinheit_Text, Liegenschaft_Text, Standort, ORGID
But the result is 'null' and on the Database is the result 9