This is the table that I am working with:
- stock_item
category, id, inventory, item, price - sales
date, employee, id, item - employees
first_name, last_name, phone, role, sinnumber
I making a query that shows all the sales record an details of the Top Salesperson.
This is my code:
SELECT s.date,
i.item,
i.price,
i.category,
Concat(e.first_name, "", e.last_name) AS TopSalesPerson
FROM sales s
JOIN employees e
ON s.employee = e.id
JOIN stock_items i
ON i.id = s.item
GROUP BY s.employee
HAVING Max(s.employee);
However, when I try to filter out the top sales person, it gives me this error:
#1055 – Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘mypetstore.s.date’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Suzy Codes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.