Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,12 @@
SELECT
-- return the first non-NULL value
COALESCE(email, phone, telegram_id) AS contact,
-- replace the key (1) with corresponding value ('email')
CASE contact_type WHEN 1 THEN 'email' WHEN 2 THEN 'phone' ELSE NULL END AS contact_type,
-- the first parameter must be a 1-based integer,
-- ELT() returns the nth argument (eg, for n=1 it will return the email column)
ELT(n, email, phone, telegram_id) AS preferred_contact,
-- returns the index of the value that is equal to the 1st argument:
-- in this example, 2
FIELD('phone', 'email', 'phone', 'telegram_id') AS type;
FROM user;