Input: postgres=> select sets from matches limit 2; sets ———————- {{6,4},{6,2}} {{6,3},{5,7},{10,4}} (2 rows) Expected (Sum of the value in each array) postgres=…
SQL UPSERT QUERY W/ Duplicate Rows Made Unique Based Upon 3 Fields (C# VisStudio)
Background is I’m making a SQL connection that takes a .csv file and imports it into a SQL Server database table. The problem I’m running into is, I’m having trouble with the query syntax because …
How to order occurrences counting from 1 to n occurrences
I have a table that contains several columns, but for the task, the important ones are id end created_date, where id can repeat. Sample data: +——–+————–+ | id | created_date | +——…
Using SQL to identify instances where there is a specified unique grouping/combination
In Oracle SQL, I am trying to identify instances where a unique combination of records is present. For example, I have table ITEMS that lists items sold by a store chain where Store_ID is the location …
Convert YYYYMMDD to MM/DD/YYYY in Snowflake
I need help in figuring out the date conversion logic in Snowflake. The documentation isn’t clear enough on this. In SQL Server, I would try SELECT CONVERT(DATE, ‘20200730’, 101) and it gives me ’07/…
Limit date for each day to 2:30 PM
SQL Oracle Query: I have datetime values in 30 minute intervals. I want to stop each day at 2:30 PM. I am limiting my hours with this: TO_CHAR(ALL_DATES.DATEDATE,’HH24′) NOT IN (01,02,03,04,05,06,07,…
Is there a way to compare Lat/long of two tables
I have two tables: address_points kmldata address_points table columns: ID address Latitude1 Longitude2 kmldata table columns: Locname Lat Long Now I want to …
Get records from table with join where records in join not contain specific value
I have two tables: Table user: create table user ( id bigserial not null primary key, username varchar(256), active boolean not null default true ); And table address: create table address ( …
Grouping Records by Key into a single row with multiple columns
I am struggling to get the data arranged how i would like. Essentially i am aiming to track a containers journey measuring time it spends in locations by looking a the times that it enters and leaves …
SQL IF in column THEN replace with the adjacent cell
I have a table with different values (alphanumeric) and an other one with translations (also alphanumeric). I want to search values from the first table if they are in a specific column of the other …