Join with more column
Join with more column
Hi, I've a table orders and a table client. I want to take either the field cognome or the field address from ort_utenti table (client table)
In join.php I have this:
$data = Editor::inst( $db, 'ort_ordini', 'idOrdine' )
->field(
Field::inst( 'ort_ordini.idOrdine' ),
Field::inst( 'ort_ordini.idCliente' ),
Field::inst ( 'ort_utenti.cognome' )
)
->leftJoin( 'ort_utenti', 'ort_utenti.id', '=', 'ort_ordini.idCliente' )
->process($_POST)
->data();
I'd like to show in a datatable an address field from ort_utenti (users) table
es.
Field::inst ( 'ort_utenti.address' ) ???
What I have to change in join.php and in html page??
Replies
I solved the problem.
I modified the join.php file:
$data = Editor::inst( $db, 'ort_ordini', 'idOrdine' )
->field(
Field::inst( 'ort_ordini.idOrdine' ),
Field::inst( 'ort_ordini.idCliente' ),
Field::inst ( 'ort_utenti.cognome' ),
Field::inst ( 'ort_utenti.indirizzo' ) // Field from ort_utenti table
)
->leftJoin( 'ort_utenti', 'ort_utenti.id', '=', 'ort_ordini.idCliente' )
->process($_POST)
->data();
and modified the script of html page: