Server-Side Processing complex JOIN and WHERE

Server-Side Processing complex JOIN and WHERE

RobsonRobson 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.

Replies

  • ignignoktignignokt Posts: 146Questions: 4Answers: 39

    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.

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin

    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

  • zeinerrjzeinerrj Posts: 11Questions: 1Answers: 2

    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"

This discussion has been closed.