这是我的查询。
展开 | 选择 | Wrap | 行号 解决方案您好,儒艮。 至少有两种方法可以解决这个问题。
- 第一种是使用TRANSFORM .... PIVOT ... IN(< valueslist> ;)语法。要自动执行< valueslist>的过程添加你需要设计VBA函数返回顺序日期列表,并通过对应的Querydef对象进行查询。
- 第二个是:
- 生成连续日期的数据集。
- 外部将其与日期字段上的表连接。
- 执行交叉表查询。
- 删除从空日期生成的空行。
CrosstabWithOuterJoin.zip (13.4 KB,477次观看次数) |
- 第一种是使用TRANSFORM .... PIVOT ... IN(< valueslist>)语法。要自动执行< valueslist>的过程添加你需要设计VBA函数返回顺序日期列表,并通过对应的Querydef对象进行查询。
- 第二个是:
- 生成连续日期的数据集。
- 外部将其与日期字段上的表连接。
- 执行交叉表查询。
- 删除从空日期生成的空行。
感谢您的回复Fish。 因此,无论我选择1号还是2号解决方案,我仍然需要手动创建外部表或键入所有可能的月份,日期和年份。 我的数据如何达到2010年或2020年之后?我需要计算闰年才能获得2月29日... 有什么方法可以从电脑的日期和时间中提取日期并从中创建一个表格吗? br /> 问候
你好,儒艮。 感谢您的回复Fish。 因此,无论我选择1号还是2号解决方案,我仍然需要手动创建一个外部表或键入所有可能的月,日和年介意。 我的数据如何达到2010年或2020年之后?我需要计算闰年才能获得29天... ...
使用解决方案#2,我会在[tblYears]创建记录,让我们比如说,2100让自己对未来的崩溃负责。 无论你是使用解决方案#1还是#2,闰年日期都正常处理。
Is有什么方法我可以从电脑日期和时间拉日期并从中创建一个表?嗯。当然,有一种方法。只是出于好奇,这种方式的优点是什么? 问候, 鱼
Here is my query.
Expand|Select|Wrap|Line Numbers 解决方案 Hello, dugong. There are at least two ways to solve the problem.- The first is to use TRANSFORM .... PIVOT ... IN (<valueslist>) syntax. To automate the process of <valueslist> adding you will need to design VBA function returning list of sequential dates and put it to query via correspondent Querydef object.
- The second is to :
- Generate dataset of sequential dates.
- Outer join it with your table on date field.
- Perform crosstab query.
- Remove empty row generated from empty dates.
CrosstabWithOuterJoin.zip (13.4 KB, 477 views) |
- The first is to use TRANSFORM .... PIVOT ... IN (<valueslist>) syntax. To automate the process of <valueslist> adding you will need to design VBA function returning list of sequential dates and put it to query via correspondent Querydef object.
- The second is to :
- Generate dataset of sequential dates.
- Outer join it with your table on date field.
- Perform crosstab query.
- Remove empty row generated from empty dates.
Thanks for your reply Fish. So whether i pick solution no 1 or 2 , i still need to manually create an external table or key-in all possible months,days and years in mind. How if my data reach a date beyond 2010 or 2020? I need to calculate the leap year to obtain 29 days february... Is there any way i could pull the date from the pc date and time and create a table from it? regards
Hello, dugong. Thanks for your reply Fish. So whether i pick solution no 1 or 2 , i still need to manually create an external table or key-in all possible months,days and years in mind. How if my data reach a date beyond 2010 or 2020? I need to calculate the leap year to obtain 29 days february...Going with solution #2, I would create records in [tblYears] up to, let us say, 2100 releaving myself of responsibility for future crash. No matter whether you go with solution #1 or #2 a leap year date is being processed normally.
Is there any way i could pull the date from the pc date and time and create a table from it?Mmmm. Sure, there is a way. Just, out of curiosity, what are advatages of this way? Regards, Fish
更多推荐
访问TRANSFORM(交叉表)查询和丢失行
发布评论