Sum from three tables in ms sql
<p>I am retrieving from three different tables</p>

<pre><code>SELECT lc_orders_tb.lc_orderID, lc_orders_tb.lc_orderSubTotal, lc_orders_tb.lc_orderTotal, lc_orders_tb.lc_orderPlacedDate, lc_tb.lc_compName, lc_tb.lc_addCity, lc_orderQuantity_tb.lc_orderID, 
     sum(lc_orderQuantity_tb.lc_orderQuantity) 
AS    lc_orderQuantity 
FROM  lc_orders_tb, lc_orderQuantity_tb, lc_tb 
WHERE lc_orders_tb.lc_id=lc_tb.lc_id 
AND   lc_orderQuantity_tb.lc_orderID=lc_orders_tb.lc_orderID 
GROUP BY lc_orderQuantity_tb.lc_orderID
</code></pre>

<p>I want to show the above retrieved values in the gridview. Only <code>lc_orderQuantity</code> needs to be summed for a particular <code>lc_orderID</code> which must match against two tables, namely, <code>lc_orders_tb</code> and <code>lc_orderQuantity_tb</code>.</p>

<p>Could someone please help me out..</p>

<p>Thank you in advance.</p>
