Loading

Add new comment

born_2_code's picture
Offline
Joined: 06/10/2010
subtracting inventory

Hi Kim! Did u already find a solution to ur problem?

If not, u can try this one.

=== this is a query to get the total received during PO, total sold during sales and the remaining qty - the link for the two tables is the "ITEM" ===

SELECT a.item_code, sum(a.receive_qty) as total_quantity, sum(b.sold_qty) as total_sold, (sum(a.receive_qty) - sum(a.sold_qty)) as remaining_qty
FROM TBLPO a left join TBLSTOCKS b ON a.item_code = b.item_code
GROUP BY a.item_code

=== don't be confuse on "item_code, receive_qty and sold_qty", I juz made it up hoping that was the fieldname on ur tables.

If you have question/clarrifications, you can send me a mcgs.

Hope this help!

born.2.code.06@gmail.com

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.