Skip to main content

All Questions

1 vote
1 answer
51 views

SQL (Snowflake) forward looking event date attribution

I have the following table with these constraints - Units can only be released or bought on a given day (one of the columns will always be 0) Units released on one day can be bought from the next day ...
Shweta Gopinath's user avatar
0 votes
1 answer
32 views

Event_date reference in CTE

I've been working on some code that will extract some aggregated data from my Google Analytics 4 export. Unfortunately I've been running into an error regarding my variable event_timestamp in my CTE ...
Paul's user avatar
  • 15
0 votes
1 answer
58 views

SQL combine two tables with date interval

I have 2 tables with start and end dates. I have to join then in a particular way: Table A: ID Start Date End Date 1 01/01/2024 10/01/2024 1 10/01/2024 15/01/2024 1 15/01/2024 20/01/2024 2 01/01/...
iacopo pacifici's user avatar
0 votes
1 answer
99 views

SQL - Transform Week String into date format

I am using SQL in Snowflake and would like to transform a column that has dates in a string format: '2023 W37' into a date format, always giving me the date ('YYYY-MM-DD') of the Monday in this week. ...
Michelle's user avatar
  • 263
0 votes
1 answer
278 views

Need to create a column name which displays current month end

I have a requirement to create a column name in snowflake such that it displays the current month end date. It should change dynamically every month. Expected table structure. Tablename:- sample ...
User30's user avatar
  • 3
0 votes
1 answer
38 views

Citibike data date format

I am using Citibike data and load it to snowflake table but as data is loaded I was having issues in loading online data I loaded it into a varchar data type. So its from CSV file and date is loaded ...
DATA's user avatar
  • 1
1 vote
2 answers
391 views

Snowflake/SQL: Split overlapping dates into new rows

I have a base table containing items and their prices between different dates. The table can be updated by users, via a file ingestion process, to put in updates/overrides for specified date periods. ...
JWebster's user avatar
0 votes
1 answer
46 views

sql group dates by 8 week period

I have one table that I created with 52 weeks, based on Weekday = Sunday. Now I need to aggregate these dates in groups of 8 weeks, but was not able to think of a logic to use in this case, I saw ...
Thiago Lima's user avatar
-2 votes
1 answer
72 views

Getting 0 results when I use BETWEEN DATEADD(MONTH,-4,CURRENT_DATE) AND DATEADD(MONTH,-1,CURRENT_DATE)

I am trying to get last 3 months data from the OTO_HISTORICAL_TRACKING_DETAIL CTE that I have created. OTO_START_DATE is in DATE format - 'YYYY-MM-DD'. This query returns 0 results SELECT* FROM ...
Kartik's user avatar
  • 35
0 votes
1 answer
154 views

How can I select every nth date in Snowflake?

Say I have a table in Snowflake with fields delivery_date, formatted as a DATETIME, and daily_volume formatted as an INT. Daily_volume follows a pattern that repeats every 10 days. How would I query ...
nwhaught's user avatar
  • 1,572
0 votes
1 answer
2k views

How can DAYOFWEEK() in Snowflake return values from 0 to 7?

There are only 7 days in the week, so the values could go from 0 to 6, or from 1 to 7. Yet the Snowflake docs say that DAYOFWEEK() can return values from 0 to 7. Is this right? https://docs.snowflake....
Felipe Hoffa's user avatar
  • 58.4k
0 votes
0 answers
39 views

Create column with data of the previous year and create row when dates don't have match

I'm trying to create a column with a data of the previous year, there is one row by type and month. However there is not in comparaison to the previous year, the current don't have a corresponding row ...
user15915737's user avatar
0 votes
1 answer
675 views

How to change date format in snowflake without changing date type to varchar?

I need to change only format of date without changing data type in one of the tables in snowflake, so i can't change global date format of my system. If i use this statement is showing the format by ...
pm1359's user avatar
  • 632
2 votes
2 answers
60 views

how to create different sequence of dates whose length equals to id length for each id?

I have a table with different length for each id and for which date_column value would be the same for each different id: id date_column A 2020-05-20 A 2020-05-20 A 2020-05-20 B ...
AlSub's user avatar
  • 1,155
-1 votes
1 answer
90 views

How to convert varchar yyyy-mm to date

I have a column of data in the format of yyyy-mm that is VARCHAR(7). Using CONVERT doesn't work and I'm guessing it's because it needs a day in the string (yyyy-mm-dd), but I don't know how to add ...
NOLA_Max's user avatar

15 30 50 per page
1
2 3 4 5
9