You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
programming-examples/sql/Joins/3Write a SQL query to displ...

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
);