Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have a table with two language_id
id ab_id subject_line language_id
1 1 test_mail_english 1
2 1 test_mail_spanish 2
3 2 test_mail_english_1 1
4 2 2
5 3 1
6 4 1
7 4 test_mail_spanish_3 2
so my output should be
id ab_id subject_line language_id
1 1 test_mail_english 1
3 2 test_mail_english_1 1
5 3 1
7 4 test_mail_spanish_3 2
here i want to write a script to get subject_lines, where it first checks for subject_line with language_id = 1, if not empty get subjectline,if it is empty, then only it has to get spanish subject_line i.e with language_id = 2. How could i do this?
Maybe this
IF(language_id='1', subject_line, IF(language_id='2' AND TRIM(subject_line)='', 'spanish') AS subject_line
IF(language_id='1' AND TRIM(subject_line)='', 'spanish', IF(language_id='1', subject_line)) AS subject_line
TAB1:
load
id,
IF(LEN(subject_line)=0 AND language_id=1,'SPANISH_SUBJECT_LINE',subject_line) AS subject_line,
IF(LEN(subject_line)=0 AND language_id=1,2,language_id) AS language_id;
TAB2:
load * inline [
id,subject_line,language_id
1,test_mail_english,1
2,test_mail_spanish,2
3,test_mail_english_1,1
4,,2
5,,1
6,test_mail_spanish_2,1
7,test_mail_spanish_3,2
];
Hi all,
Can you look into updated query. I think i was not clear in my question. i have written expected output.