I have problem in calculating the value in same colume in query, here is my logic:

if SerialNo equal to previous SerialNo AND ActionID equal to previous ActionID then Date minus previous Date, otherwise display 0 in DayCalculate
In Excel, I can sort the ActionID and SerialNo and create the formular the calucate the value as following:

ActionID SerialNo Date DayCalculate
100 1 01-Jan-07 0 Day
100 1 02-Jan-07 0 Day
101 2 01-Feb-07 0 Day
102 3 03-Jan-07 0 Day
102 3 04-Jan-07 0 Day
103 3 07-Jan-07 3 Day



If(AND(B3=B2, A3<>A2),C3-C2,0)
Is it possible to have the same function in create a query to calucate the DayCalculate? Please Help