且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Access中创建时间序列并可以在查询中使用它

更新时间:2023-02-18 20:02:59

是.创建这样的查询:

SELECT DISTINCT 
    [Tens]+[Ones] AS Factor, 
    10*Abs([Deca].[id] Mod 10) AS Tens, 
    Abs([Uno].[id] Mod 10) AS Ones
FROM 
    msysobjects AS Uno, 
    msysobjects AS Deca;

将其另存为qdyFactor. 然后创建此查询:

Save it as qdyFactor. Then create this query:

SELECT DISTINCT 
    DateAdd("d",[Factor],[DateFrom]) AS Dates
FROM 
    qdyFactor
WHERE 
    qdyFactor.Factor Between 0 And DateDiff("d",[DateFrom],[DateTo]);

这将创建日期列表. 最后,使用它来过滤和汇总其他表.

This will create the list of dates. Finally, use this to filter and sum from your other tables.