Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

how can I use aggregate functions in an inner join model?

$
0
0
there are two tables named 'production.product' and 'sales.sales order detail'
they should be joined with inner-join model:

SELECT SO.ProductID,P.NAME, MAX(ORDERQTY) FROM Sales.SalesOrderDetail SO
INNER JOIN PRODUCTION.PRODUCT P
ON SO.PRODUCTID=P.PRODUCTID
GO
NOW THERE IS A PROBLEM: I dont know how to use MAX FUNCTION with GROUP BY in an inner join
would you please help me to write the correct syntax?

Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>