cross apply sub queries
<p>Hi just learning sql server</p>

<p>this gives me an error :</p>

<pre><code> Incorrect syntax near ')'.'
</code></pre>

<p>Query:</p>

<pre><code>SELECT p1.categoryid
    ,p1.productname
    ,p1.unitprice
FROM production.products AS p1
CROSS APPLY (
    SELECT min(p2.unitprice)
    FROM production.products AS p2
    WHERE p1.categoryid = p2.categoryid
    )
</code></pre>