Hi All,
I am wanting to perform a Threshold query, whereby one would take the Value of a field from Today, and compare it to the value from yesterday, this query would look something like this, but obviously, it is wrong, and I can't find how to do it:
select
TableB.Name,
TableA.Charge,
(
select Charge
from TableA
where (DateAdded >= '13/10/2009' and DateAdded < '14/10/2009')
)
from TableA
inner join
TableB on TableB.ID = TableA.ID
where
TableA.DateAdded >= '10/14/2009'
order by
Name asc
Just a quick note, I am looking for two CHARGE
fields, not the dates. The date manipulation is simply for Today and Yesterday, nothing more.
At the end of this, I want to do a calculation on the two returned charge fields, so if its easier to show that, that would also be great.
Thanks in advance
Kyle
EDIT1:
The data I am looking for is like so:
Yesterday, we input a charge of 500 to MachineA Today we input a charge of 300 to MachineA
We run the query, and results I need are as follows:
Name = MachineA
Charge = 300
YesterdayCharge = 500