Skip to Content
author's profile photo Former Member
Former Member

Query for batchwise remaining stock

Hello

i create the following query that show remaining quantity in that batch the quer are as,

SELECT T0.[ItemCode], T0.[Quantity], T0.[WhsCode], T3.[ItmsGrpNam], T1.[DistNumber] FROM OBTQ T0 INNER JOIN OBTN T1 ON T0.AbsEntry = T1.AbsEntry INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod WHERE T0.[WhsCode] ='WH01' ORDER BY T3.[ItmsGrpNam], T0.[ItemCode]

but i want to more field in that query that it should show purchase price for that batch & remaining quantity

the qurey should display

Item code , Remaining Quantity, Warehouse,ItemGrpName,batch Num, Purchase Price

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 24, 2012 at 03:35 PM

    Hi,

    Try:

    SELECT T0.ItemCode, (T0.Quantity-T0.CommitQty) 'Remaining Qty', T0.WhsCode, T3.ItmsGrpNam, T1.DistNumber,T2.LastPurPrc

    FROM OBTQ T0

    INNER JOIN OBTN T1 ON T0.AbsEntry = T1.AbsEntry

    INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode

    INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod

    WHERE T0.WhsCode ='WH01'

    ORDER BY T3.ItmsGrpNam, T0.ItemCode

    Thanks,

    Gordon

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.