xxxxxxxxxx
specify your id, which table's id are you taking from to avoid ambiguity
example:
<?php
public function getItemsBannedWord(Scenario $scenario)
{
return $scenario->Items()
->oldest('items.id') // here -> instead of (id), change to (yourtable.id)
->join('banned_words', function($qb){
$qb->on('items.name_ja', 'banned_words.ng_word')
->orOn('items.name_en', 'banned_words.ng_word');
})->first();
}
?>
xxxxxxxxxx
SQL supports qualifying a column by prefixing the reference with either the
full table name:
SELECT tbl_names.id, tbl_section.id, name, section
FROM tbl_names
JOIN tbl_section ON tbl_section.id = tbl_names.id
or a table alias:
SELECT n.id, s.id, n.name, s.section
FROM tbl_names n
JOIN tbl_section s ON s.id = n.id
Ambiguous, means that mysql doesn't know which column to order by, you have two columns with the name name, you probably need to prefix it with the table name as well.
answer given by Tray2 in https://laracasts.com/discuss/channels/laravel/sqlstate23000-integrity-constraint-violation-1052-column-name-in-order-clause-is-ambiguous