我写了以下代码:
((SELECT SUM(noteAmount)
FROM notes
WHERE DATE_FORMAT(noteDate, '%d-%m-%Y') = DATE_FORMAT(note1.noteDate, '%d-%m-%Y') AND noteType = 'in')
-
(SELECT SUM(noteAmount)
FROM notes
WHERE DATE_FORMAT(noteDate, '%d-%m-%Y') = DATE_FORMAT(note1.noteDate, '%d-%m-%Y') AND noteType = 'out')) as trxCount
这应该在WHERE语句的给定时间段内使用表SELECT *
FROM BMD_MI_OPS.DBH_TELEFONIE
WHERE cast(DATUM_TIJD as date) BETWEEN 1180212 AND 1180217;
UPDATE BMD_MI_OPS.DBH_TELEFONIE
SET QUEUE_NAAM = REPLACE(QUEUE_NAAM, '_DVB', '');
的所有列。然后,它将擦除列BMD_MI_OPS.DBH_TELEFONIE
中出现的每个_DVB。例如,QUEUE_NAAM
应该变成VQ_PAR_EC_00_DVB
。
我想我做错了,对完成此操作的任何帮助将不胜感激。
谢谢。
答案 0 :(得分:2)
您的语句未链接,如果要更新数据,则需要在WHERE
中添加UPDATE
子句
例如:
UPDATE BMD_MI_OPS.DBH_TELEFONIE
SET QUEUE_NAAM = REPLACE(QUEUE_NAAM, '_DVB', '')
WHERE CAST(DATUM_TIJD AS DATE) BETWEEN 1180212 AND 1180217;
在更新之前选择行对您的更新没有影响,只是SELECT