0
DEV|MUL
xyz|null
null|abc
123|456

我想获取另一列为空的列的值,或者如果两者都有来自mysql的值,则专门获取一列

4

3 回答 3

1

您可以使用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
于 2012-11-03T05:59:43.657 回答
0
SELECT IFNULL(DEV, MUL) AS VALUE from table table1; 

DEV如果它是返回列值,这将返回not nullMUL值。

于 2012-11-03T06:00:06.730 回答
0
select * from tablename where (columnname is null)
and
select * from tablename where (columnname1 is null) and (columnname2 is null)
于 2012-11-03T06:01:13.477 回答