mercredi 28 mars 2018

How to do this query in Laravel 5.4?

The query is:

SELECT * FROM `noticias` WHERE `fecha` in ( select `fecha` from `noticias` group by `fecha` having count(*) > 1)

I´m trying in this form:

DB::table('noticias')->groupBy('fecha')->having('fecha', '>', 1)->get();

But this give me the error: SQLSTATE[42000]: Syntax error or access violation: 1055 'conversiones.noticias.id' isn't in GROUP BY (SQL: select * from noticias group by fecha having fecha > 1)

Thanks!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GzBras
via IFTTT

Aucun commentaire:

Enregistrer un commentaire