我有一张桌子"用户"包含5列' ID','名字','姓氏','年龄''电子邮件'。
是否可以执行此sql命令?
SELECT LTRIM(RTRIM(firstname,lastname,email)) FROM User
我需要选择的是3个被修剪的列。
答案 0 :(得分:3)
您需要单独修剪每个字段
select ltrim(rtrim(firstname)), ltrim(rtrim(lastname)), ltrim(rtrim(email))
from User
答案 1 :(得分:1)
您必须单独处理每个列,如:
SELECT LTRIM(RTRIM(firstname)) as firstname,
LTRIM(RTRIM(lastname)) as lastname,
LTRIM(RTRIM(email)) as email
FROM [User]
答案 2 :(得分:1)
使用此:
SELECT
LTRIM(RTRIM(FirstName)) AS FirstName,
LTRIM(RTRIM(LastName)) AS LastName,
LTRIM(RTRIM(Email)) AS Email
FROM User
您需要单独对所有列进行TRIM。