-
Find the Longest Consecutive Rising Streak of a Single Stock
2026-11-11 19:17Chinese Version https://c.raqsoft.com.cn/article/1794395615324
-
Convert Time Columns into Rows and Pivot into a New Cross Table
2026-11-10 17:59That turned out to be a bug that generated flawed SQL. It’s been fixed now, so the missing-columns defect is resolved.
WITH t1 AS ( SELECT ID, PartNum, 'EnteredOn' AS action_type, EnteredOn AS t_stamp FROM tb UNION ALL SELECT ID, PartNum, 'PickedTime' AS action_type, PickedTime AS t_stamp FROM tb UNION ALL SELECT ID, PartNum, 'DeliveredTime' AS action_type, DeliveredTime AS t_stamp FROM tb ), t5 AS ( SELECT t_stamp , concat_ws('', PartNum, '_', ID) AS col_name , CASE WHEN action_type = 'EnteredOn' THEN 'ENTERED' WHEN action_type = 'PickedTime' THEN 'PICKED' WHEN action_type = 'DeliveredTime' THEN 'DELIVERED' ELSE NULL END AS status FROM t1 WHERE t_stamp IS NOT NULL ), t5_2 AS ( SELECT t_stamp, col_name, status , FIRST_VALUE(status) OVER (PARTITION BY t_stamp, col_name ORDER BY NULL) AS FIRST_1 FROM t5 ) SELECT t_stamp , MIN(CASE WHEN col_name = '50A_100' THEN FIRST_1 END) AS `50A_100` , MIN(CASE WHEN col_name = '50A_171' THEN FIRST_1 END) AS `50A_171` , MIN(CASE WHEN col_name = '60B_125' THEN FIRST_1 END) AS `60B_125` , MIN(CASE WHEN col_name = '70B_211' THEN FIRST_1 END) AS `70B_211` FROM t5_2 GROUP BY t_stamp -
Debugging SQL Should Be Just Like Debugging Code
2026-11-05 14:14chinese version: https://c.raqsoft.com.cn/article/1790230152716
-
First Record with a Specific Value Within Each Group
2026-11-03 11:45chinese version https://c.raqsoft.com.cn/article/1793677346179
-
chinese version https://c.raqsoft.com.cn/article/1789895397944
-
chinese version https://c.raqsoft.com.cn/article/1788937060353
-
chinese version:https://c.raqsoft.com.cn/article/1789110227653
-
Convert Time Columns into Rows and Pivot into a New Cross Table
2026-10-22 14:00chinese version: https://c.raqsoft.com.cn/article/1792648545386
-
Flag Office Visits Within 6 Months After Surgery
2026-10-14 14:12chinese version https://c.raqsoft.com.cn/article/1791958021916
-
Start and End Dates of the Longest Rising Period
2026-09-30 13:29chinese version:https://c.raqsoft.com.cn/article/1790745869083
-
Is SQLazy Something Missing from Your dbt Workflow?
2026-08-26 19:56Chinese Version: https://c.raqsoft.com.cn/article/1787187473949
-
Chinese version:https://c.raqsoft.com.cn/article/1787370820290
-
SQLazy: Get the Latest Closed Before ConfirmationStarted
2026-08-14 17:21Chinese Version https://c.raqsoft.com.cn/article/1786698960696
-
Chinese Version: https://c.raqsoft.com.cn/article/1786092062618
-
SQLazy: Find Strings with 5 or More Consecutive Alphabetical Letters
2026-07-31 10:30Chinese Version: https://c.raqsoft.com.cn/article/1785464625134
-
SQLazy: Order-Level Warehouse Assignment Based on SKU Conditions
2026-07-24 17:40Chinese version: https://c.raqsoft.com.cn/article/1784885783040
-
Chinese Version:https://c.raqsoft.com.cn/article/1784687529128
-
SQLazy: Fill Field Values by Sequence Across Sub-Groups
2026-07-17 19:13Chinese Version:https://c.raqsoft.com.cn/article/1784286598944
-
SQLazy: Identify Whether Differences Within Groups Come from Brand or Type Problem Description
2026-07-16 20:44Chinese version: https://c.raqsoft.com.cn/article/1784196284211
-
SQLazy:Merge Multiple Tables into Single Rows by Common ID
2026-07-15 18:01Chinese version: https://c.raqsoft.com.cn/article/1784109363970
-
SQLazy:Forward Fill NULL Values
2026-07-14 17:53Chinese version https://c.raqsoft.com.cn/article/1784022426270
-
SQLazy:Conditional Running Total with Reset
2026-07-09 10:20Chinese version:https://c.raqsoft.com.cn/article/1783563051055
-
A Field Guide to Querying and Report Computations with SPL
2025-10-27 18:23 -
Looking for the Best SQL-On-File Tool for Analyst
2020-08-26 09:27
Chinese version https://c.raqsoft.com.cn/article/1793928791451