1
我創造了這個表:如何僅提取MySQL中的姓氏?
create table customers
(
code varchar(7),
fullname varchar(9),
CONSTRAINT pk_codreparacion PRIMARY KEY (code)
);
我插入此日期:
insert into customers(code, fullname)
values('001','John Smith');
insert into customers(code, fullname)
values('002','William Thorne');
insert into customers(code, fullname)
values('003','Mark Johanson');
的問題是:我可以得到只有在MySQL協商姓氏?即,約翰·史密斯= '史密斯'
你有沒有聽說過[substring_index](http://www.w3resource.com/mysql/string-functions/mysql-substring_index-function.php )? – Raju
由於Raju表示使用'substring_index',但如果你正在創建你的表,包括兩個字段'FirstName'和'LastName' –
你保證全名總是由兩個單詞組成? –