I have a table P that looks something like this: ID | Status | Env 1 | 1 | Linux 1 | 1 | Windows 1 | 3 | Mac 2 | 1 | Linux 2 | 1 | Windows 2 | 1 | Mac 3 | 3 | …
Primary key conflict when merging databases (auto-increment)
I have two SQLite databases which I would like to merge. I’m doing it by using the following commands: ATTACH “c:other.db” AS SecondaryDB INSERT INTO MyTable SELECT * FROM SecondaryDB….
DateAdd function in Oracle SQL
How can I convert DATEADD(week,-4,GETDATE())in the where clause ( in Oracle SQL) Trying to get data for prior 4 weeks Answer In Oracle, you would use: Or, if you prefer:
Select Distinct in inner join with full customer record
I have two tables one with customer and another with invoices. I need to find all customer that have an more that one invoice with different days with in a period. Invoice table: Accountnum Datein …
Merge left on load data from BigQuery
I have an input table: input and one or more maptables, where input contains data for multiple identifiers and dates stacked under each other. The schemas are as follows: #input Id: string (might …
How to query in DB2 for distinct column value, rather than a distinct row?
I’m trying to construct a DB2 query that returns distinct rows, but for the distinction to be based on only one column’s values. The query below will allow multiple rows with the same order number if, …
Query to show top 3 records per user where the user has submitted a minimum of 3?
I have in a table in MS SQL with multiple entries per user. I am trying to get the top 3 entries by date for each user. I have a query that returns returns the maximum top 3 entries per user but is …
Redshift – Is there a way to merge rows based on a common column
I have a table like this Node_id | channel | timestamp | value | folder_id 242278 | return_status | 2020-07-28 14:29:26 | “Return Created” | …
Query for Age calculation and Date comparison inconsistent
I’m doing some counts to validate a table XXX, I designed 2 queries to calculate people younger than 18 years. The query i’m using is the following: select count(distinct user.id) from user left join …
How to filter record in a table with different condition
How to find the record in a table which as only ‘Return’ as Reason? I have table which has many records As per the data in the table, it returns only records with policy number 5555, because only that policy number has only ‘Return’; all other policy numbers have both ‘ReturnR…