Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

laravel leftJoin table from 2 field

How can i select leftJoin table info in different field?

Table Food:

id name category other-category

1  Apple  1             2

Table Category:

id name

1  Plantae

2  Rosids


->leftJoin('Category', 'Food.category', '=', 'Category.id')
->leftJoin('Category', 'Food.other-category', '=', 'Category.id')

But I got an error:

Not unique table/alias:

Here, I want: Food.name, category.name, other-category.name

Comments