sql subquery RRS feed

  • Question

  • Hello,

    I like to bring inventory on hand quantity and consumption quantity into one pivot table or report. Curranty it is 2 SQL scripts and 2 pivot tables.
    Database table name is [item ledger entry]. on hand quantity column is [Remaining Quantity], consumption quantity column is [Quantity] then defined by [Entry Type].

    When I add WHERE L.[Entry Type] = '5', the remaining quantity become 0.
    My script is like this.

    SELECT L.[Remaining Quantity], L.[Quantity], L.[Entry Type]
    FROM [CRONUS Canada, Inc_$Item Ledger Entry] AS L
    WHERE L.[Entry Type] = '5'

    Can use subquery? SQL expert please help. Thank you.
    Saturday, December 26, 2020 8:51 PM