Category "sql"

Attempt to read from field 'android.view.View androidx.recyclerview.widget.RecyclerView$ViewHolder.itemView' on a null object reference

I am making an app that gets data from sql and puts it in a recycle view i first tried it in a list view but i found it easier in a recycle view it is basically

Remove duplicates from SQL Window function

I'm trying to sum values inside a window function but I can't figure out have to prevent summing duplicates. Below is a snippet of the results I have right now.

SQL - Find customers who bought all products

Suppose I have 2 tables: Table A C_ID P_ID 1 1 1 2 2 1 Table B P_ID 1 2 In Table A, C_ID and P_ID serve as PK, in Table B P_ID

Convert string date format MM/dd/yyyy HH:mm:ss.SSSS to timestamp presto

I have a string that looks like: 2022-03-30 17:18:09.569000 I am trying to convert this to a timestamp as follows: select "date_parse"("date_format"('2022-03-3

Find syntax error IN SQL query using python

I want to parse sql file using python code and find any syntatical error present in the file. Is there any way to do it?

How do you extract a specific field from a JSON array in Big Query?

I currently have a JSON array that looks like this in Big Query: [{"name":"","username":null},{"name":"Jimmy Dean","username":"iamjc"},{"name":"Ben Simmons","us

Collapse multiple rows into a single row based upon a break condition

I have a simple sounding requirement that has had me stumped for a day or so now, so its time to seek help from the experts. My requirement is to simply roll-up

What is wrong with this inner join sql query

I want to export some data from the DB. Basically what I want to say is this: 1- Select mbr_name from the members table 2- Choose the ones that exist at the cou

Snowflake SQL Compilation Error: View Definition Declared but view Query Produced

I've just gotten a new query error that I haven't changed anything to. Any advice on what to do? Thanks SQL compilation error: View definition for '**********'

BigQuery query review for session based attribution

I've been struggling for a while to get a query to return the number of sessions and users per source/campaign/medium/content, based on the current session of t

Pivot two columns

I have data that looks likes: stu_id course_name staff_name 1 Economics - 3 Kuzma, Brian 1 History Hulings, Kreg 1 IHS IB Lit of Americ Duncan, Amy 2 Marine Bi

Is there any way to update json column?

ALTER TABLE managers UPDATE JSONExtractString(managers.extra_data, 'name') = JSONExtractString(other_table.extra_data, 'name') WHERE 1 Query above does not wor

In sql I want to a query in which it gives me the duplicates. However, i would like to see the duplicates side by side. Instead of just count

Select employee.id,count(employee. Id), employee.name From employee_database Group by employee.id, employee.name Having count (employee.id) >1

SQL - Generate column from sum of columns from different table

I have two tables: The first one contains numeral values, it looks like this: The id column is the primary key; it has the attribute AUTO_INCREMENT. All col

How query data use offset in kusto (Azure Data Explorer) KQL for paging

How can I realize below SQL query use offset for paging query in KQL. select * from testtable where code = '88580' limit 1000 offset 111 I can't find any funct

Is there any difference between python scripts in airflow and same script in python

I was writing the below code but it is running endless in airflow, but in my system it take 5 min to run gc=pygsheets.authorize(service_account_file='file.json'

How to fix unknown column when working with joins in SQL

The column does exist in the table, however when I run this query, I get an error of "unknown column". I ran explain & describe to double-check my table Er

Right outer join with multiple where conditions

I'm having some issues returning any results from my SQL query. I'm pretty sure it's got something to do with the WHERE condition. I want only certain RULE_ID

group by cols but with a value

Question on the sql, any help is appreciated dataset: a_col b_col 1 null null 1 2 null null 2 expected output a_col b_col gro

NTILE only for values different from zero

I have a column with many zeros and I want to put only non-zero values into N groups of (approximately) equal sizes. All zero values should get group number 0.