I try to delete duplicated row in my code with :
$post = new posts();
$post->raw('DELETE b1 FROM baroot b1,baroot b2 WHERE b1.post_id = b2.post_id AND b1.id > b2.id');
and my model code is :
class posts extends Model
{
protected $table = 'baroot';
protected $fillable = [
'post_id', 'title', 'modify',
];
}
I try to delete duplicated with :
$post = new posts();
$post->raw('DELETE b1 FROM posts b1,posts b2 WHERE b1.post_id = b2.post_id AND b1.id > b2.id');
but any duplicated rows not deleted, I know the sql query is correct but don't work with my laravel code
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire