I have an INT64 column called “Date” which contains many different numbers like: “20210209” or “20200305”. I want to turn those numbers into a date with this format: MM-…
INNER JOIN multiple columns to same column from another table
I got hmmd_prm table that is: | id | hmmd_id | prm1 | prm2 | prm3 | prm4 | prm5 | prm6 | prm7 | prm8 | prm9 | prm10 | | 1 | 2 | 1 | 2 | 3 | 1 | 2 …
How do I create a dict of values from the results of an SQL query?
I’m trying to create a journey booking system in python/flask and am trying to create a dict of starting destinations and their ending destinations to allow me to run some ajax code which restricts the options of selecting destination based on the starting location like this (this is just an example of …
Filter out Duplicates that follow each other in Sequence with BigQuery SQL
I’m looking for a way to filter out row sequences with the same column value while keeping the first element of the sequence. Given the following table: id location timestamp 1 A 1001 2 B 1002 3 A …
Split Array Into Parts – Get all Unique Items – GoogleSQL
I’m looking to take a String-Array field in Google SQL and transpose it to show all in one column. From there I can take all unique/distinct items from it. the image above is a sample of what I am …
Add the last appearance to table
I have two tables (for example) table1 will contain stores, there are 2 types ‘candy store’ and ‘dental store’. Each row contains information about a customer’s purchase in a particular store table1 ( purchases ): table2 ( type ): I want my query to return a table like this: wher…
Calculate cumulative product value
I have the following database table: Date Return Index 01-01-2020 0.1 Null 01-02-2020 0.2 Null 01-03-2020 0.3 Null I would like to update the Index value using the following …
Apply multiple count conditionally in SQL Server query
I have a task table which contains some DateTime type columns like completed, pending, exception. It joins user table and I want to bring userName, AllTaskCount, AllPendingTaskCount, …
Calculate cumulative value in update query using SQL
I have the following database table: Date Return Index 01-01-2020 0.1 Null 01-02-2020 0.2 Null 01-03-2020 0.3 Null I would like to update the Index value using the following …
SQL paramaterisation in C#, using SQL declared variables
I have the following SQL query which I am sending from a C# program: DECLARE @id as int SELECT @id = max(fault_catagory_ident) FROM fault_catagory_list INSERT INTO fault_catagory_list (…