I have the following tables:
TABLE A
id
info
TABLE B
f_id
question
choices
TABLE C
f_id
question
lines
The id from the Table A always match a f_id from either Table B or C, but never both. I want to join Table B and Table C on table A only when it matches so I would get a table with the following columns :
id | info | question | choices | lines
where all rows are filled in the question column, some are NULL in the column choices and some are NULL in the column lines.
What I tried is to do two consecutive left joins, but the second one overrides the first so all the rows that doesn't match in Table C (second left join) get a NULL value in the question column.
Is there a way to do a query that will not override previously joined data with NULL values? I'm working with Laravel Eloquent, so any of raw SQL or Eloquent Query would help me.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ySNwk8
via IFTTT
Aucun commentaire:
Enregistrer un commentaire