Welcome Back

Google icon Sign in with Google
OR
I agree to abide by Pharmadaily Terms of Service and its Privacy Policy

Create Account

Google icon Sign up with Google
OR
By signing up, you agree to our Terms of Service and Privacy Policy
Instagram
youtube
Facebook

Get Product Stock History Using InventoryLogs

Get Product Stock History Using InventoryLogs

InvertLogs Table:



Query Explanation:

  • SELECT: Retrieves stock change records from the table.

  • ChangeInStock: Shows how stock changed (positive = added, negative = removed).

  • ActionType: Indicates the reason for the stock change (AddedSoldReturned, etc.).

  • LogDate: Timestamp when the stock change occurred.

  • ORDER BY ProductID, LogDate: Displays logs in chronological order per product.


SQL Query:

SELECT 
    ProductID,
    ChangeInStock,
    ActionType,
    LogDate
FROM 
    InventoryLogs
ORDER BY 
    ProductID,
    LogDate;


Output: