Timeline for How to give precedence to rows from one table over matching rows in another?
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 13, 2021 at 7:13 | comment | added | user2616355 | @ypercubeᵀᴹ would it be possible to have a full query or dbfiddle, I was trying and could not figure out how to do it. | |
Jun 5, 2021 at 23:07 | comment | added | ypercubeᵀᴹ |
@user2616355 yes, you could have a CASE expression in the SELECT list or a simple check, eg: SELECT ..., (b.value IS NOT NULL) AS value_comes_from_b ...
|
|
Jun 3, 2021 at 22:02 | comment | added | user2616355 |
is it possible to know which table COALESCE matched in ?
|
|
Dec 21, 2017 at 4:00 | comment | added | jpmc26 |
If you only need 1 row, won't the JOIN be just as efficient as the subqueries? In which case, I'd favor the improved readability and flexibility of the JOIN .
|
|
Dec 20, 2017 at 20:32 | history | edited | ypercubeᵀᴹ | CC BY-SA 3.0 |
added 174 characters in body
|
Dec 20, 2017 at 20:25 | history | edited | ypercubeᵀᴹ | CC BY-SA 3.0 |
added 174 characters in body
|
Dec 20, 2017 at 20:24 | vote | accept | Code Poet | ||
Dec 20, 2017 at 20:22 | comment | added | ypercubeᵀᴹ | It's just a way to pass the parameter once (so it isn't in the two WHERE clauses). You could also expand the list of keys inside the VALUES, to more than one. | |
Dec 20, 2017 at 20:21 | comment | added | Code Poet |
COALESCE is brilliant. However, I don't understand what (VALUES ('key.A')) AS prm (key) is doing?
|
|
Dec 20, 2017 at 19:54 | history | answered | ypercubeᵀᴹ | CC BY-SA 3.0 |