[ASK]
如何在mysql中删除null?
CREATE VIEW konsumenlist AS select
(select nama_konsumen where jenis_kelamin_konsumen="laki-laki" ) as Laki_laki,
(select nama_konsumen where jenis_kelamin_konsumen="perempuan" ) as Perempuan
from konsumen;
select * from konsumenlist;
答案 0 :(得分:0)
如果我理解你,我认为这很容易。您需要使用IFNULL
或COALESCE
CREATE VIEW konsumenlist AS select
IFNULL((select nama_konsumen where jenis_kelamin_konsumen="laki-laki" ),'---') as Laki_laki,
COALESCE((select nama_konsumen where jenis_kelamin_konsumen="perempuan" ),'---') as Perempuan
from konsumen;