Reputation: 161
DEV|MUL
xyz|null
null|abc
123|456
I want to get the value of a column where the other one is null or get specifically one column if both have values from mysql
Upvotes: 0
Views: 159
Reputation: 5588
select * from tablename where (columnname is null)
and
select * from tablename where (columnname1 is null) and (columnname2 is null)
Upvotes: 0
Reputation: 34367
SELECT IFNULL(DEV, MUL) AS VALUE from table table1;
This will return DEV
column value if it is not null
otherwise return MUL
column value.
Upvotes: 0
Reputation: 26386
You can use IFNULL
SELECT IFNULL(DEV, MUL) as Col FROM myTable -- MySql
SELECT ISNULL(DEV, MUL) as Col FROM myTable -- SQL Server
SELECT NVL(DEV, MUL) as Col FROM myTable -- Oracle
Upvotes: 1