I have an xml which I need to read using Snowflake SQL. I need to use the attribute name and lits value to fetch the data. For example -> id and “bk101” to fetch the contents. I am currently using below query- In this case I am passing the index 0-4 to fetch the data is not producing correct results.
Tag: snowflake-sql
Join on Id in Variant (Array) Snowflake
I have two tables t1 and t2 created as follows: Create Tables Goal I am looking to join t2 to t1 if the id of the record exists in the t1 variant array. What I’ve Tried I came across the ARRAY_CONTAINS function which looked perfect. But with the following I am receiving no results: How Do I Get This? Any
SQL to append records
I have two tables tbl1 and tbl2. Consider tbl2 as the main set and tbl1 has been derived from other sources but will essentially now be a subset of tbl2. tbl1 cd productcd type 1 1 A 1 2 AB 1 3 A 2 3 AB 2 4 AC 3 1 A tbl2 cd productcd type priority 1 1 A
SQL 30 day active user query
I have a table of users and how many events they fired on a given date: DATE USERID EVENTS 2021-08-27 1 5 2021-07-25 1 7 2021-07-23 2 3 2021-07-20 3 9 2021-06-22 1 9 2021-05-05 1 4 2021-05-05 2 2 2021-05-05 3 6 2021-05-05 4 8 2021-05-05 5 1 I want to create a table showing number of active users
Snowflake: SQL Query to identify all the different users with the same ID from the same or multiple tables
There are two tables with both IDs and Usernames. Looking for a snowflake SQL query that results in identifying the IDs shared by different users from the same table or both tables. Table 1 ID User 1001 A 1002 B 1003 C 1002 D 1005 E Table 2 ID User 1006 H 1005 E 1003 G 1002 F 1001 A
How to select two last year in more actual year
I would like to know how we can select the two last year in more the current year. For example, If I have a table like it : Then I want it : I tried to use dateadd like it : But I just got the 2 last year since now, I would like to got 2019, 2020 and 2021