0
Subtracting one record from another within the same table limited to a field
I have designed a database but need support on the following:
* within the same table
* subtract the current record from the last record
* but only from matching fields in the first column
for example:
Table
Field 1 Field 2 Field 3
Vehicle Cost Difference from last Vehicle (Car) Cost
Car $100 0
Car $150 $50
Truck N/A
Bicycle N/A
Car $350 $200
I found this in the Help Line but it subtracts the last field without differentiating by the first column
let me := this;
'spend' - last((select 'TableName' where number(_id) < number(me._id)) order by number(_id)).'spend'
Gruss aus Amerika. Ich wunsche euch einen guten Rutsch ins neue Jahr.
Antwort
Content aside
- vor 11 StundenZuletzt aktiv
- 9Ansichten
-
1
Folge bereits