在Django模型中有两个datefield,即start_date和end_date。我想计算和存储两者之间的总天数,这将与每日费用一起使用,以返回总成本。
models.py
class Booking(models.Model):
"""Stores the bookings, for example when it was made, the booking date, and the car ID."""
# Unique ID for this booking.
start_date = models.Date
Access查询:
IIf([rptd mean net (g)] > 0, [rptd mean net (g)] - ([Actual Tare Wt (g)] - [Machine Tare Wt (g)]), [Mean Gross (g)] - [actual tare wt (g)]) AS [Net Mean Wt (g)]
以下是我从access 获得的结果
SQL查询:
SELECT
CASE
WHEN [Net Weight Tracking].[Rptd Mean Net (g)] > 0
THEN (([Net We