Skip to main content

All Questions

0 votes
0 answers
23 views

How to find the elapsed time between timestamps in column A based on when column B starts and stops having the value 'LM'

Basically, I have outbound call history data for agents and need to flag when they are working on the autodialer, doing manual calls, and doing voicemails. The logic for determining when an agent is ...
sthot88's user avatar
0 votes
0 answers
35 views

How Do I get Only latest data processed in my sql table

Scenario: The table contains data inserted over a 7-day window where data from the 11th to the 17th of each month is inserted daily. Sometimes, overlapping data is inserted, and the challenge is to ...
mayank agrawal's user avatar
-1 votes
3 answers
76 views

SQL Flag By Group

CREATE TABLE t (STUDENT int, SCORE int, DATE date) ; INSERT INTO t (STUDENT, SCORE, DATE) VALUES (1, 6, '2022-02-01 00:00:00'), (1, 2, '2022-03-12 00:00:00'), (1, 5, '2022-04-...
bvowe's user avatar
  • 3,344
0 votes
2 answers
90 views

SQL : Find Differences between columns and only till 12 rows and then sum the differences

I am looking for SQL to Find Differences between columns and only till 12 rows and then sum the differences. For example this is the table I have TAB_PAYOUT. Column DIFFERENCE is calculated by ...
Nash's user avatar
  • 89
1 vote
1 answer
35 views

How to only took data that the status never change from beginning (SQL)

i have a data like this in my SQL snowflake my expected value is i want only took the user_id that the status always 'low' never change from start to the end month I really stuck, how to only took ...
rien312's user avatar
  • 75
0 votes
0 answers
161 views

(Airbyte) MySQL to Snowflake error: connection was unexpectedly lost

I'm using airbyte to transfer data from MySQL database to Snowflake Database. Airbyte is deploy on EC2 t2.medium (CPU usage is between 60 to 70%) with 16GB storage capacity. When the airbyte ...
user15915737's user avatar
0 votes
1 answer
232 views

How can I combine the values of multiple columns, all in different tables, into a single column in a view?

I am working with multiple tables in a data vault in Snowflake. All the data is to do with business journeys for a company; air, rail, car rental, hotel stays. I need to create views in the ...
fil_sql's user avatar
1 vote
2 answers
150 views

Left joining on one of multiple columns from right table, depending on value from the left table

I have two tables which I need to join: Table A, which has to be the leftmost table, and Table B, which must be joined onto it via LEFT JOIN. I cannot use a UNION in this scenario. Table A: ID Data ...
hov's user avatar
  • 109
0 votes
0 answers
235 views

SQL: Group by Histogram Error: 'select clause is neither an aggregate nor in the group by clause'

I'm new to SQL language and I'm getting a 'select clause is neither an aggregate nor in the group by clause' error with my sample code below. Here, I have a table 'pkg_data' with a pkg_type column (...
Bensa's user avatar
  • 139
0 votes
0 answers
66 views

Use of Replace in SQL when Listagg function is used that will output distinct variables

I have the following query: select distinct a.product_desc as "Product", a.PRODUCT_ID as "Product ID", (a.START_DATE ::timestamp) as "Start Date", LISTAGG(DISTINCT a....
suzy's user avatar
  • 3
1 vote
1 answer
1k views

How to find difference between two timestamp in Snowflake and result should also be timestamp

I have a requirement where I have to find time difference between two timestamp in snowflake and the output should also be timestamp i.e. it should have days, hour, minute and seconds(DD HH24:MI:SS). ...
Nishant Verma's user avatar
1 vote
2 answers
300 views

return list of int using case when then MySQL

select * from table where columnType in( case when TRUE then (1,2) end ); This query is giving syntax error Invalid argument types for function 'IFF': (BOOLEAN, ROW(NUMBER(1,0), NUMBER(1,0)), NULL). ...
Mukul Kumar's user avatar
0 votes
1 answer
41 views

I want to derive a column for sql table. Can someone tell what would be the best possible scenario or workaround for this

consider following table ID. ACCT_ID GEO IND Timestamp abcd XEMXOAA5 IN Y 2023-05-04 10:08:51.000 efgh XEPPKAAX IN Y 2023-05-04 10:08:51.000 ijkl ...
Omkar More 's user avatar
0 votes
1 answer
127 views

Invalid syntax when using the cursor.execute in python ( sagemaker notebook)

select * FROM HEVOPROD_DB.HEVOPROD_SCH.PRDNEW_METERING where REQUESTED_SERVICE = '["dsp"]' and longitude is not null ; The above query works fine when i query this in snowflake while using ...
lifo's user avatar
  • 19
1 vote
1 answer
33 views

how to get 1st column value using partition

I have a table looks like this CREATE TABLE myTable ( userid text, webid text, "timestamp" timestamp ); INSERT INTO myTable ("userid", "webid&...
ccwiris's user avatar
  • 29

15 30 50 per page
1
2 3 4 5
8