Azure逻辑应用程序: Filter Query Difference between dates should not exceed 10 months

标签 azure azure-functions azure-logic-apps power-automate

就像在 SQL Server 中一样,我们使用 DATEDIFF 查找日期之间的差异,如下所示,我尝试在 SQL Server - 获取行 连接器中使用 OData 过滤器查询,但我没有看到 DateDiff 函数可用。

SELECT DATEDIFF(month, DateOfBirth, GETDATE()) AS DateDiffInMonths from employees where DateDiffInMonths > 10;

我通过引用 Power Automate 的几个链接尝试了下面的 ODATA 查询,但它不起作用,因为表达式中不存在 DateDiff 看起来像

DateDiff(utcNow(), DateOfBirth, Months ) ge 10

您能否分享一下我们如何使用 OData 筛选器查询或任何其他方式在获取行本身期间立即筛选出表记录来实现此目的的建议?

提前致谢

最佳答案

要查询10个月可以使用过滤器查询

month(hire_date) lt month(@{subtractFromTime(utcNow(),10,'Month')})

例如:- 假设我有这些记录

enter image description here

enter image description here

这是输出

enter image description here

<小时/>

一般情况下你可以使用

year(hire_date) gt year(<Timestamp>) and 
month(hire_date) gt month(<Timestamp>) and 
day(hire_date) gt day(<Timestamp>) and so on

您甚至可以更改日期时间格式并进行比较。

一般查询

enter image description here

这是我收到的输出

enter image description here

引用文献: Azure Logic App SQL ODATA Filter on Date

关于Azure逻辑应用程序: Filter Query Difference between dates should not exceed 10 months,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71239084/

相关文章:

azure - 如何通过 Azure 逻辑应用程序使用模板将 CSV 转换为 JSON

azure - 使用 ARM 模板通过服务主体身份验证为 Azure 数据工厂创建 API 连接

Azure 逻辑应用程序和函数应用程序性能差异

azure - 无法通过点到站点 VPN 连接连接到 azure SQL

c# - Azure Function 与源一起发布

python - 从 Azure 容器下载 blob 的最佳实践

javascript - 使用 request() 和回调时,如何不在 Azure Function 中调用 context.done() 两次?

azure - 如何从 Azure IoT 中心获取设备上的日期时间?

azure - 是否可以从 Azure Function 停止/启动 Azure ARM 虚拟机?

c# - 依赖注入(inject)在本地 Azure 函数中不起作用