2

Does anyone nows how to replace null values with another column in another table in SQLite

say this select statement

SELECT t1._id , t1.name , t2.img FROM
t1 JOIN t2 on (t1._id = t2._id);

if t1._id == null i want to return t2._id in that column

1 Answer 1

3

see this: http://sqlite.awardspace.info/syntax/sqlitepg09.htm

What you want is a case statement

SELECT case when t1._id is null then t2._id else t1._id end as id, t1.name , t2.img FROM
t1 JOIN t2 on (t1._id = t2._id);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.