You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your code is almost correct, just another mistake to put a line of code, and get lost with your own Aliases of table.
Here i make the correct one, with inline comment and more verboses for readability.
DataTables::create(db_connect()
// call table "users" with alias "u"
->table('user AS u'))
// select whatever you want, and call another field as join// for better performance, better to call each collumn you want to fetch instead using wildcard
->select('u.*, p.nom AS name')
// join another table "prestataire" alias "p", with condition "p.id_prestataire = u.prestataire_id"
->join('prestataire AS p', 'p.id_prestataire = u.prestataire_id')
// put the where clause (don't forget to call it with prefix alias previously define)
->where('u.prestataire_id IS NOT NULL')
// rest of your code here ...
->make()
I think the select function is ignored, i cann't do a custom select when fields are conflicting.
i have table
user{ID, nom, prenom, prestataire_id}
andprestataire{ID, nom}
. I want to select with join but with no chance.I need help !
The text was updated successfully, but these errors were encountered: