【问题标题】:SQL in Matlab: Create a date with queryMatlab 中的 SQL:使用查询创建日期
【发布时间】:2018-06-27 23:45:24
【问题描述】:

我有每日数据:

     Isin             Date          Price   
 ______________    ____________    __________ 
'GB00B1YW4409'    '31.12.1999'    [688.1300]
'GB00B1YW4409'    '03.01.2000'    [688.1300]
'GB00B1YW4409'    '04.01.2000'    [690.6200]
'GB00B1YW4409'    '05.01.2000'    [666.9500]
'GB00B1YW4409'    '06.01.2000'    [650.7600]
'GB00B1YW4409'    '07.01.2000'    [663.2200]
'GB00B1YW4409'    '10.01.2000'    [694.3500]
'GB00B1YW4409'    '11.01.2000'    [683.7700]
'GB00B1YW4409'    '12.01.2000'    [675.0500]
'GB00B1YW4409'    '13.01.2000'    [664.4600]

我想列出每个月的第一天。比如:

'01.01.2000'
'01.02.2000'
'01.03.2000'

我想到了类似的东西

select distinct date(year(List.Date),month(List.Date),01) as Data from List

但我收到一条错误消息:

Error using COM.ADODB_Connection/Execute
Invoke Error, Dispatch Exception:

Source: Microsoft Access Database Engine

Description: Wrong number of arguments used with function in query expression

'date(year(List.Date),month(List.Date),01).

我做错了什么?

【问题讨论】:

    标签: sql matlab date ms-access


    【解决方案1】:

    MS Access 中的date() 函数返回当前日期。

    您正在寻找dateserial():

    select distinct dateserial(year(List.Date), month(List.Date), 01) as Data
    from List;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-08
      • 2010-11-13
      • 2014-06-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多