programming-examples/sql/Joins/3Write a SQL query to display the average price of items of each company, showing the name of the company.sql
2019-11-18 14:05:53 +01:00

10 lines
420 B
SQL

/*3Write a SQL query to display the average price of items of each company, showing the name of the company.*/
SELECT A.pro_name, A.pro_price, F.com_name
FROM item_mast A INNER JOIN company_mast F
ON A.pro_com = F.com_id
AND A.pro_price =
(
SELECT MAX(A.pro_price)
FROM item_mast A
WHERE A.pro_com = F.com_id
);