In almost every DBMS by default, and MySQL if you configure it properly, this query will be flatly rejected as an error.
What values of ponum and status would you expect to be returned when you are only grouping by itemname?
The fields that you select either must be included in the "group by" clause or must be used in aggregate functions, like SUM.
Suppose you had a number of purchase orders - what output would you expect to see for these "extra" fields?
+-------+------------+------------+-----+
| ponum | status | itemname | qty |
+-------+------------+------------+-----+
| 111 | Complete | Keyboard | 1 |
| 222 | Complete | Keyboard | 2 |
| 222 | Complete | Mouse | 1 |
| 333 | InProgress | Keyboard | 1 |
| 333 | InProgress | Mouse | 1 |
| 333 | InProgress | Chair | 1 |
+-------+------------+------------+-----+
select itemname, ponum, status, sum(qty)
from ...
group by itemname ;
+----------+-------+------------+----------+
| itemname | ponum | status | sum(qty) |
+----------+-------+------------+----------+
| Chair | 333 | InProgress | 1 |
| Keyboard | ??? | ??? | ??? |
| Mouse | ??? | ??? | ??? |
+----------+-------+------------+----------+
If you can't tell the query which value you want within the grouping, the query should give up and throw an error.
MySQL is one of the few DBMS that does not do this by default.
Regards,
Phill W.