English 中文(简体)
将此复杂的 SQL 转换为 KQL
原标题:Convert this complex SQL in to KQL
Can you please help me to convert this complex SQL in to KQL? It s generating list of days as a temp table (Alias days) and joining with table1 using joining condition of created_date between start_date ("01-01-2024") and end_date ("12-31-2024"). SELECT pk,day FROM table1 JOIN UNNEST (GENERATE_DATE_ARRAY(DATE_SUB(DATE("12-31-2024"), INTERVAL 30 DAY), DATE("12-31-2024"))) AS days ON DATE(created_date, "US/East") between DATE_SUB(day, INTERVAL DATE_DIFF(DATE("12-31-2024"), DATE("01-01-2024"), DAY) DAY) AND day; My solution is something like this below: But this KQL doesn t produce expected output. let days = range day from "01-01-2024" to "12-31-2024" step 1d; let temp_table = table1 | join kind=inner (days) on $left.created_date == $right.day
问题回答
You can use below modified query to achieve your requirement. For sample, I have used a temporary table b which will have dates from 2024-12-30 to 2025-01-10. let a = range day from datetime( 2024-01-01 ) to datetime( 2024-12-31 ) step 1d; let b = range thisweek from datetime( 2024-12-20 ) to datetime( 2025-01-10 ) step 1d; a| join kind=inner b on $left.day==$right.thisweek; Here, the data type when using range should be of your column data type. Result:




相关问题
Windows Azure WorkerRole response

I am working on an Azure demo to run Powershell in a worker role. In my web role I add the name of the Powershell script which is to be run to a CloudQueue object. I can print the script output to ...

Windows Azure WebRole stuck in a deployment loop

I ve been struggling with this one for a couple of days now. My current Windows Azure WebRole is stuck in a loop where the status keeps changing between Initializing, Busy, Stopping and Stopped. It ...

Getting a token for Windows Azure

We are looking at Windows Azure, but getting a token appears to be hard now, at least that s what I m seeing in web searches. Anyone tried it or know how to accelerate that process? Any idea how long ...

Developing Azure .Net 4.0 Applications

Presently .Net 4.0 is not supported on Azure. This thread indicates that you will not be able to use .Net 4.0 with VS 2010 until it is supported in the cloud. http://social.msdn.microsoft.com I d ...

.NET 4.0 on Windows Azure?

My google-fu is failing me on this one. As a possible solution to Unit Testing .NET 3.5 projects using MStest in VS2010 (but I ve put this in a seperate question because it s kind of unrelated): Is ...

热门标签