SELECT a_id, c_id, company, address, phone, date, time, place
FROM app
WHERE (LTRIM(RTRIM(company)) = 'YOKOGAWA INDIA LIMITED'
错误:在YOKOGOWA INDIA LIMITED附近显示错误的语法不正确
答案 0 :(得分:6)
你错过了WHERE
条款中的密切关注:
SELECT a_id, c_id, company, address, phone, date, time, place
FROM app
WHERE (LTRIM(RTRIM(company))) = 'YOKOGAWA INDIA LIMITED'
答案 1 :(得分:1)
where
应为:
WHERE
(LTRIM(RTRIM(company))) = 'YOKOGAWA INDIA LIMITED'
修改强>
LTRIM删除varchar中的第一个空格。所以如果你有这样的陈述:
SELECT LTRIM(' Remove the first spaces')
将返回:
'Remove the first spaces'
RTRIM将删除varchar中的最后一个空格。所以如果你有这样的陈述:
SELECT RTRIM('Remove the last spaces ')
将返回:
'Remove the last spaces'
如果要删除varchar中的所有空格。我建议使用replace
SELECT REPLACE('Remove all spaces please',' ')
这将返回
Removeallspacesplease
因此,如果您不确定字符串是否包含空格,我会使用LIKE。像这样:
WHERE
company LIKE '%YOKOGAWA INDIA LIMITED%'
答案 2 :(得分:1)
WHERE子句中有一个不匹配的左侧paren。您的查询应如下所示:
SELECT a_id, c_id, company, address, phone, date, time, place
FROM app
WHERE LTRIM(RTRIM(company)) = 'YOKOGAWA INDIA LIMITED'