只是学习SQLite ...我运行以下查询:
select guests.[GUEST_NAME],guests.[GUEST_SURNAME],guest_data.[START_DATE],guest_data.[END_DATE]
from guests
INNER JOIN guest_data
ON guests.guest_id=Guest_data.guest_id
order by guests.[GUEST_SURNAME] ASC
可以,但是我需要学习:如何在DAYS获得更多字段
作为start_date,end_date之间的datediff?我尝试添加:
select guests.[GUEST_NAME],guests.[GUEST_SURNAME],guest_data.[START_DATE],guest_data.[END_DATE],DAYS as Daysbetween(guest_data.start_date,guest_data.end_date)
但它不起作用。另外,如何用delphi编写此查询?
最佳答案
select guests.[GUEST_NAME],guests.[GUEST_SURNAME],guest_data.[START_DATE],guest_data.[END_DATE],
julianday(guest_data.end_date) - julianday(guest_data.start_date) AS DAYS_INTERVAL
from guests
INNER JOIN guest_data
ON guests.guest_id=Guest_data.guest_id
order by guests.[GUEST_SURNAME] ASC
请尝试这种语法结构,并及时通知我们。
您的天数间隔应在名为“ DAYS_INTERVAL”的结果集中作为单独的列返回