'how do u use a group by when using fields from different tables

Ive tried running the following query on my database but when I do it shows the wrong information

I am trying to show every product that has been bought and who bought it and instead It shows that every product has been bought by every customer.

SELECT Cust_Name, prod_type, purchases.purch_id

FROM CUSTomers, product, purchases, orders

Where Purchases.purch_id = orders.PURCH_ID

AND orders.prod_id=product.prod_id;

when I have asked my lecturer how i should change the query I was told I should be look into group by clause but when I add one I get the error message "ORA-00979: not a GROUP BY expression" This is the structure of the relevant tables



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source