Question : I have the following query SELECT SQL_NO_CACHE `table1`.* FROM `table1` LEFT JOIN `table2` ON table2.id = table1.table2_id WHERE […]
Tag: coalesce
Column reference is ambiguous’ when upserting element into table
Question : I am using PostgreSQL as my database. And I need to create an entry in the database, and […]
Merging continous date range using T-SQL
Question : I have a table containing a part time working pattern consisting of start and end dates together with […]
Oracle database – get two rows (A,B) for every (COD) row
Question : I have a Oracle database and a variable that can have a value for A and a value […]
Ignore the joins without any result in SQL Server
Question : Situation I’m making a SQL server query to filter data from the projects table (tblProjecten). This table got […]
How to select TOP 1 value from each column where value is not null
Question : I am trying to select many columns from a table where there can be multiple rows with the […]
How to SELECT TOP(1) with COALESCE to pick the top NOT NULL row for each column?
Question : I have a hierarchy of settings that have a default for everyone, can be overridden by groups, or […]
COALESCE with cast
Question : I’m pulling data from a jsonb column in Postgres, and casting it to an integer to compare it […]
joining tables with full outer join and… COALESCE?
Question : I have a few tables in an Oracle database linked by id – fk_id, if I do: select […]
How can I group the null results in this FULL OUTER JOIN with non-null responses?
Question : I am looking at the overlap and non-overlap (unique values) of users-ids from two different select statements using […]