Server-Side Processing complex JOIN and WHERE
Server-Side Processing complex JOIN and WHERE
Robson
Posts: 1Questions: 0Answers: 0
Hello, I need a way to build an array for $whereResult in ssp.class.php and send it to
echo json_encode(
SSP::complex( $_GET, $sql_details, $table, $primaryKey, $columns, $whereResult)
);
but I also need to use INNER JOIN clauses, eg:
SELECT
L.NUMERO_LAUDO,
L.ANO_LAUDO,
L.DATA_LAUDO,
S.NOME AS NOME_LEGISTA,
D.NOME AS NOME_DESTINATARIO,
L.LAUDO,
L.DESTINATARIO
FROM IML.LAUDOS L
INNER JOIN SSPJ.SERVIDORES S
ON S.SERVIDOR = L.LEGISTA
INNER JOIN SSPJ.DEPARTAMENTOS D
ON D.DEPARTAMENTO = L.DESTINATARIO
WHERE L.DESTINATARIO = $destinatario;
Any help would be great.
This discussion has been closed.
Replies
You can take a look at my server-side example.
It will handle that and any other query you can come up with by simply passing it into datatables as a subquery.
The SSP example class does not currently support joins. You would either need to modify the class to add support for joins, or use another library such as @ignignokt's.
Allan
Hello ignignokt,
Given your example, I believe you can achieve a join by simply using:
$table = "IML.LAUDOS L
INNER JOIN SSPJ.SERVIDORES S ON S.SERVIDOR = L.LEGISTA
INNER JOIN SSPJ.DEPARTAMENTOS D ON D.DEPARTAMENTO = L.DESTINATARIO"