Need help with leftjoin statement.
Need help with leftjoin statement.
pinowski
Posts: 2Questions: 1Answers: 0
I'm drawing a blank on this. I can get the following leftjoin to work, but I want to limit the data to only users in the table with an "admin" column set to true in the database. I'm not sure if I should use the where statement and if so, what to put in place of the ???. I've experimented with no success other than having the leftjoin work. Thanks.
->leftJoin('users', 'users.user_id', '=', 'jobs.user_id')
->where('users.???', $_POST['???'])
->process( $_POST )
->json();
This discussion has been closed.
Answers
I think:
should be all that is needed (where 1 is boolean true to the db).
Allan
The value in the db is not boolean for some reason. It's a VARCHAR (i.e., YES or NO). I tried the following, but it did not exclude those with a NO valuel
->where('users.is_admin', 'YES')
Could you show me the whole of the PHP please? That looks like it should work.
Allan