Sorry for my bad english!
Well, my problem is this:

I have 2 tables: "Standby" and "Usage".
Standby store all the equipements.
Usage store the times that the equipement is used (replaced) and received (placed) in Standby.

My problem is there:

Select Standby.PartNº,Standby.Stock1, Standby.Stock1 - (SUM([Usage].Quant_Used)-SUM([Usage].Quant_Received)) as [No Exterior], Standby.Area from [Usage] RIGHT JOIN Standby ON [Usage].PartNº=Standby.PartNº GROUP BY Standby.PartNº,Standby.Area,Standby.Stock1

this code is working BUT in some equipments (Standby.PartNº is the equip id) that have no corresponde in Usage table it dont calcule anything like:
PartNº Stock1(total) NO Exterior Area
001 2 aab
002 2 1 aab
003 3 2 1bb
004 2 2 avv

in partn=001 this is no rows with that partn so it send nothing?!

i had this code but it send me error:
Select Standby.PartNº,Standby.Stock1, Standby.Stock1 - (SUM(ISNULL([Usage].Quant_Used),0)-SUM(ISNULL([Usage].Quant_Received),0)) as [No Exterior], Standby.Area from [Usage] RIGHT JOIN Standby ON [Usage].PartNº=Standby.PartNº GROUP BY Standby.PartNº,Standby.Area,Standby.Stock1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.