1
我試圖在特定條件下追加許多字段的名稱。在連接中使用Concat表達式
這工作得很好:
select * from course
left join courseterm on course.courseID = CourseTerm.courseID
where courseterm.termID like 1 or 2
and course.expires not like '0000-00-00 00:00:00'
這也工作得很好:
UPDATE course SET course.Title = CONCAT(`Title`, ' ');
然而,這告訴我,我有我的語法錯誤:
update course
set course.title = CONCAT('2015/2016-',`Title`)
left join courseterm on course.courseID = CourseTerm.courseID
where courseterm.termID like 1 or 2
and course.expires not like '0000-00-00 00:00:00';
我可以弄清楚什麼是錯的。任何人?
這樣做!謝謝!我更改了where子句:更新課程 left join courseterm on course.courseID = CourseTerm.courseID set course.title = CONCAT('2015/2016 - ','Title') where courseterm.termID = 1 or courseterm .termID = 2 and course.expires not like'0000-00-00 00:00:00'; –
我已經更新答案..所以如果提供的是...解決你的問題,如果公平標記爲aceppeted .. – scaisEdge