Combining 2 SQL queries into 1
<p>I have a complex (for me) query that I can't seem to get right.  I can get the data I'm looking for separately but need to combine them in same query.  I am not looking to use a view or a temp table.</p>

<pre><code>SELECT PRODUCT_T.PRODUCTSTANDARDPRICE AS PSTANDARDPRICE
FROM PRODUCT_T, USES_T
WHERE PRODUCT_T.PRODUCTID = USES_T.PRODUCTID
</code></pre>

<p>This query returns:</p>

<p>PSTANDARDPRICE</p>

<p>175</p>

<p>200</p>

<p>200</p>

<p>750</p>

<p>Then I do:</p>

<pre><code>Select uses_t.productid, sum(rawmaterial_t.materialstandardprice*uses_t.quantityrequired) AS TOTALRAWMATERIALCOST
From rawmaterial_t, uses_t
Where rawmaterial_t.materialid = uses_t.materialid
Group by uses_t.productid
order by productid
</code></pre>

<p>This query returns:</p>

<p>PRODUCTID   TOTALRAWMATERIALCOST</p>

<p>1                   120</p>

<p>2                   62.4</p>

<p>3                    307.2</p>

<p>I'm looking for:</p>

<p><a href="https://i.stack.imgur.com/Ypp4C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ypp4C.png" alt="enter image description here"></a></p>

<p>I've tried to use a sub query, I've tried to use a Join with the two queries and I've tried a UNION in desperation.  </p>

<p>This gets me close but TOTALRAWCOSTPERPRODUCT is the same for every row which is incorrect </p>

<pre><code>SELECT PRODUCT_T.PRODUCTID, PRODUCT_T.PRODUCTSTANDARDPRICE AS PSTANDARDPRICE, TOTALRAWCOSTPERPRODUCT 
 FROM (
Select uses_t.productid, sum(rawmaterial_t.materialstandardprice*uses_t.quantityrequired) AS TOTALRAWCOSTPERPRODUCT
From rawmaterial_t, uses_t
Where rawmaterial_t.materialid = uses_t.materialid
Group by uses_t.productid
), PRODUCT_T, USES_T
WHERE PRODUCT_T.PRODUCTID = USES_T.PRODUCTID
</code></pre>

<p>How can I get to where I need to be?</p>