Top "Coalesce" questions

COALESCE is a SQL function that returns the first non-NULL expression among its arguments.

SQL Server: how can I use COALESCE with a PIVOT table?

What I'm trying to do is provide a value if another value doesn't exists within my pivot table. Pivot table …

sql-server pivot coalesce
Spark: coalesce very slow even the output data is very small

I have the following code in Spark: myData.filter(t => t.getMyEnum() == null) .map(t => t.toString) .saveAsTextFile("…

scala apache-spark coalesce
Select multiple rows from SQL into one row in subquery

I have query like: DECLARE @razem VARCHAR(MAX); SELECT Ordering.orderID , Document.number, (User_info.name +' '+ User_info.…

sql sql-server coalesce
Why is T-SQL ISNULL() truncating the string and COALESCE is not?

Given the following: SELECT ISNULL('XY' + NULL, 'ABCDEFGHIJ') -- Outputs ABC (Why?) SELECT COALESCE('XY' + NULL, 'ABCDEFGHIJ') -- Outputs ABCDEFGHIJ …

sql-server tsql coalesce isnull truncation
Postgres coalesce to empty JSONB array

How can I coalesce a null column into an empty JSONB array? This doesn't work: SELECT jsonb_array_elements(coalesce(…

sql arrays postgresql coalesce jsonb
Union query distinct on one column

I would like results from the second query to override results from the first query: SELECT "panel_restaurants_restaurant"."id", "…

sql postgresql join union coalesce
Using COALESCE in SQL view

I need to create a view from several tables. One of the columns in the view will have to be …

sql-server tsql sql-server-2008 coalesce sql-view
SQL Conditional JOIN column

I want to determine the JOIN column based on the value of the current row. So for example, my job …

sql join case conditional-statements coalesce
Setting a variable with select inside coalesce

How do I fix up this part of my stored procedure? The select will either return 1, 0, or null. If the …

sql variables select sql-server-2000 coalesce