I have a dataset like below: Id A14_Comment A15_Comment A16_Comment 1 Comment1 null null 2 Comment2 Comment3 Comment4 3 null Comment5 …
Why does my “INSERT INTO” Statement not work?
I am working with Apache derbyDB (db2) and SQL Workbench as environment. I have 10k records of data and I want to create a star schema with dimension tables and a fact table. dwh_price_paid_records = …
Running total with condition and always looking at the previous value
I want to do a sequential sum in a table by taking into consideration a few extra conditions. We need to make sure that when the sum is taken sequentially so if a id has +40 then the next sum would be …
How can I ‘flatten’ a one to many table with URLs so that each additional URL shows up in a new column?
I’m trying to ‘flatten’ a one to many relationship using SQL to create a CSV of points and their associated photos to use with a web map. Table 1 is a list of points and their locations, and Table 2 …
Select distinct by one column in Oracle but displaying multiple columns too
I have this query: select DISTINCT cpc.EXTRACT_ID, cpc.OS_ID,…,cpvi.VOYAGE_STRT_DT, cpob.FISCAL_MONTH_START_DT from CPOB_PROCESS_CTRL cpc inner join CPOB_PLY_OUTSTD_BAL cpob on cpc….
How to Create SELECT for Total sales for each region
I want to write a query to get Total sales for every region, but i cant figure the way to do it. I have these tables: Region(RegionID, Name) Client(ClientID, Name, City, Country, Email, RegionID) …
Filter orders by product post type in WooCommerce admin orders list page
I am new to WooCommerce, And I want to customize admin order list page. So basically I created new product type. Now I also made restriction that customer can purchase my custom product type’s product …
PostgreSQL – Help comparing two tables against three specific columns
I need to match three columns across two tables. A query should select a row in t1 and search for any row in t2 where ALL three columns listed below match. tbl_staged_documentation (t1 for reference)…
Race Condition between SELECT and INSERT for multiple columns
Note: This is a question which is a follow up of this solution. You need to read the link to get context for this question. Also, this is for postgres v9.4 If we want to return multiple columns now …
SELECT from 50 columns
I have a table that has many columns around 50 columns that have datetime data that represent steps user takes when he/she do a procedure SELECT UserID, Intro_Req_DateTime, Intro_Onset_DateTime, …