0

我有一张这样的桌子:

+---------+---------+-----------------------------------------+
| type    | city    | name                                    |
+---------+---------+-----------------------------------------+
| cricket | kolkata | Khadim's Ashok Malhotra Cricket Academy |
| cricket | kolkata | Calcutta Cricket Coaching Center (C4)   |
| cricket | kolkata | Sambaran Banerjee Cricket academy       |
| cricket | kolkata | Bournvita cricket acadamemy of arun lal |
| cricket | kolkata | friends of the stadium                  |
| cricket | kolkata | pankaj roy cricket academy              |
| cricket | kolkata | sunil gavaskar cricket foundation       |
| cricket | kolkata | castlewood india                        |
| cricket | kolkata | GK sports                               |
| cricket | kolkata | NULL                                    |
| cricket | kolkata | NULL                                    |
| cricket | kolkata | NULL                                    |
| cricket | kolkata | NULL                                    |
| cricket | kolkata | NULL                                    |
| cricket | kolkata | NULL                                    |
+---------+---------+-----------------------------------------+

我想给出不同的名称而不是NULL,我该怎么做?

4

2 回答 2

0

尝试IFNULL

Select IFNULL(name,'Jon Smith') as name from myTable

如果您在 name 中的值为 null 时想要该机构的名称,您可以::

Select IFNULL(name,institute) as name from myTable
于 2012-12-29T20:19:22.617 回答
0

您也可以使用它:

从...开始name

select * from table_name where name like "Cricket%"

包含任何地方

select * from table_name where name like "%Cricket%"

以。。结束

select * from table_name where name like "%Cricket"
于 2012-12-29T20:49:02.170 回答