I have this SQL query:
select
p1_0.name,
p1_0.description,
p1_0.price,
cast(sum(p1_0.quantity) as integer),
p1_0.img_link
from
product p1_0
group by
p1_0.name,
p1_0.description,
p1_0.price
and it is not working if I try this way.
Here is my db: enter image description here
The results I want it return is for each row of query, it return me one of the p1_0.img_link
I know the error will return is column:
p1_0.img_link” must appear in the GROUP BY clause or be used in an aggregate function.
But how to solve it?
product_name | des | price | quantity | img_link -> rs i Want
product 2 string 2.0 20
product 1 string 2.0 132
New contributor
Kiên Phạm Thanh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.