Please enclose code between 3 backticks.
May 4, 2018
3
Level 1
how I do a this query
I try many forms that to make this query:
SELECT r.id, t.nombre, sum(cantidad), t.precio
FROM alistamiento a, renglon r, renglon_trabajo rt, trabajo t
WHERE a.fecha BETWEEN '2018-04-01' AND '2018-04-30' AND
a.id = r.alistamiento_id AND
r.id = rt.renglon_id AND
rt.trabajo_id = t.id AND
t.centro_id = 4 GROUP by t.id`
But Laravel send me this error:
SQLSTATE[42000]: Syntax error or access violation: 1055 'u162268723_picma.t.precio' isn't in GROUP BY (SQL: SELECT r.id, t.nombre, sum(cantidad), t.precio FROM alistamiento a, renglon r, renglon_trabajo rt, trabajo t WHERE a.fecha BETWEEN '2018-04-01' AND '2018-04-30' AND a.id = r.alistamiento_id AND r.id = rt.renglon_id AND rt.trabajo_id = t.id AND t.centro_id = 4 GROUP by t.id, r.id, t.nombre)
Finally I group by all columns together, but the query repeat rows...
Someone who can help me :|
Please or to participate in this conversation.