Skip to content
Advertisement

Tag: snowflake-cloud-data-platform

SQL: Grouping Paired Rows Without Field to Aggregate On

So say I have the following: Timestamp Event_Name 10:47:00 RESUME 10:37:52 SUSPEND 10:26:20 RESUME 09:48:27 SUSPEND 09:39:13 RESUME 09:15:38 SUSPEND 09:11:42 RESUME I want to be able to pair them as such: Suspend Resume null 10:47:00 10:37:52 10:26:20 09:48:27 09:39:13 09:15:38 09:11:42 If each pair had another field to group on I would use a listagg window function but I

Snowflake – Issues with table filtering on dates

I’ve created a query that produces a set of dates based on start and end date. Everything works fine, but when I try to filter the underlying table to only produce the records between my range, it still results with all the underlying dates. I’ve tried using between, changing the variables to dates using to_date(), nothing worked. Any ideas? Answer

Is SQL floating point sum affected by the order-by clause?

Unlike the pure mathematical real numbers, or even the rational numbers, the floating-point number types are not commutative-associative. This means, as is commonly known in numerical coding, the order of a list of floating-point numbers affects the value of the floating-point sum. It can be a good idea to sort the list to put the smaller numbers first before adding

Advertisement