Link to home
Create AccountLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SQL Statement help

User generated imageHi

I am Have two tables. One called BOM (Bill of Materials) and another called Parts. I am trying to join the two as shown my SQL and get the Stock Level of the "Comp Part No" in the Parts table where the "Comp Part No" is the "Part No". 

I am doing something wrong

  Select b.[Part No], b.Description, b.[Comp Part No], Case WHEN [Stock Level] - (800 * b.Quantity) < 0 THEN 'yes' ELSE 'no' End As Requisition,b.Description1,b.Description2, b.Quantity As [BOM Quantity],800 As [Comp Part Quantity],800 * Quantity As [Total Quantity],p.[Stock Level],p.[Minimum Stock Level],p.[Stock Level] - (800 * b.Quantity) As [Stock After Order],p.[Stock Level] - (800 * b.Quantity) - p.[Minimum Stock Level] As [Below Minimum By] From BOM b Left Join Parts p On b.[Part No] = p.[Part No] Where b.[Part No] = '50C2011560'   

Open in new window


SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account