Thursday, 2 January 2020

SQL Key-Value Paired Join

SELECT * FROM Tabe1 u
JOIN (
(123, 'peter6@gmail.com', 3),
(555, 'jbrown@gmail.com', 4),
(946, 'jdoe12@gmail.com', 1)
) v(EmployeeId, Email, Department)
ON (
v.Email = u.Email
and v.EmployeeId = u.EmployeeId
)


No comments:

SQL: Generate a range of numbers

SELECT ones.n + 10*tens.n + 100*hundreds.n + 1000*thousands.n FROM       (VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) ones(n),      (VALU...