我有这个问题,但我无法弄清楚它为什么不能运作。相关的时间戳是
source_date_time_stamp = 6/02/2015 12:56:01 AM
destin_date_time_stamp = 5/22/2015 12:56:01 AM
相关SQL查询
SQL = "SELECT source_db.date_time_stamp as source_date_time_stamp," & _
"source_db.review_matter_id as source_review_matter_id, " & _
"source_db.in_sample as source_in_sample, " & _
"source_db.[Short Name] as source_short_name, " & _
"source_db.[Title Line 1] AS source_title_line_1, " & _
"source_db.Completed AS source_completed, " & _
"source_db.[DDF Rating] AS source_statement_date, " & _
"source_db.[Total Assets] AS source_total_assets, " & _
"source_db.[Liquid Assets] AS source_liquid_assets, " & _
"source_db.Liabilities AS source_liabilities, " & _
"source_db.[Net Worth] AS source_net_worth, " & _
"source_db.[Gurantor Statement Date] AS source_guarantor_statment_date, " & _
"source_db.[Gurantor Total Assets] AS source_guar_total_assets," & _
"source_db.[Gurantor Liabilities] AS source_guar_liablities," & _
"source_db.[Gurantor Net Worth] AS source_guar_net_worth, " & _
"destin_db.date_time_stamp AS destin_date_time_stamp " & _
"FROM (borrowers source_db " & _
"LEFT JOIN borrowers destin_db " & _
"ON source_db.review_matter_id = destin_db.review_matter_id " & _
"AND source_db.borrower_id = destin_db.borrower_id" & _
") IN '" & sourceDB & "' " & _
"WHERE source_db.date_time_stamp > destin_db.date_time_stamp"
答案 0 :(得分:1)
使用DateDiff:
"WHERE DateDiff("s", source_db.date_time_stamp, destin_db.date_time_stamp) > 0"
答案 1 :(得分:0)
我有时用于快速而肮脏的解决方案的一个方法是使用cdbl()函数将时间戳值转换为数值。它可以让您查看预期的逻辑是否独立于日期约定而应用。
'Your example dates in your question results in
'source_date_time_stamp = 42,157.0388888889
'destin_date_time_stamp = 42,146.0389004630
where语句如下:
"WHERE cdbl(source_db.date_time_stamp) > cdbl(destin_db.date_time_stamp)"
除此之外