我收到错误:'你的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以便在'HAVING(SUM(当PTSD2E_1为空,然后1个0结束)+ SUM时使用正确的语法(在尝试运行此更新时,在第3行的PTSD2E_2'时的情况)如果少于2个缺失值,则该语句尝试使用求和行(如PTSD_Total)更新表。代码在作为SELECT运行时有效.PTSD_Total列在表中作为tinyint存在(如当前用空值填充的值很小。任何有助于发现我的错误的帮助。
UPDATE mytablename
SET PTSD_Total = ((SUM(IFNULL(PTSD2E_1,0)))+(SUM(IFNULL(PTSD2E_2,0)))+
(SUM(IFNULL(PTSD2E_3,0)))+(SUM(IFNULL(PTSD2E_4,0)))+
(SUM(IFNULL(PTSD2E_5,0)))+(SUM(IFNULL(PTSD2E_6,0)))+
(SUM(IFNULL(PTSD2E_7,0)))+(SUM(IFNULL(PTSD2E_8,0)))+
(SUM(IFNULL(PTSD2E_9,0)))+(SUM(IFNULL(PTSD2E_10,0))))
HAVING (SUM(CASE WHEN PTSD2E_1 IS NULL THEN 1 ELSE 0 END)+SUM(CASE WHEN
PTSD2E_2 IS NULL THEN 1 ELSE 0 END)+SUM(CASE WHEN PTSD2E_3 IS NULL THEN 1
ELSE 0 END)+SUM(CASE WHEN PTSD2E_4 IS NULL THEN 1 ELSE 0 END)+SUM(CASE WHEN
PTSD2E_5 IS NULL THEN 1 ELSE 0 END)+SUM(CASE WHEN PTSD2E_6 IS NULL THEN 1
ELSE 0 END)+SUM(CASE WHEN PTSD2E_7 IS NULL THEN 1 ELSE 0 END)+SUM(CASE WHEN
PTSD2E_8 IS NULL THEN 1 ELSE 0 END)+SUM(CASE WHEN PTSD2E_9 IS NULL THEN 1
ELSE 0 END)+SUM(CASE WHEN PTSD2E_10 IS NULL THEN 1 ELSE 0 END)) < 2;
答案 0 :(得分:0)
经过大量的搜索和重新排序......这有效......万一它可以帮助其他人!
private async void Capturar_Click(object sender, RoutedEventArgs e)
{
SpeechRecognizer reco = new SpeechRecognizer(language);
string[] responses = { "1", "2", "3", "4", "5", };
var listConstraint = new Windows.Media.SpeechRecognition.SpeechRecognitionListConstraint(responses, "Comandos");
reco.Constraints.Add(listConstraint);
await reco.CompileConstraintsAsync();
IAsyncOperation<SpeechRecognitionResult> op = reco.RecognizeAsync();
reco.Timeouts.EndSilenceTimeout = TimeSpan.FromSeconds(1.2);
op.Completed += HandleCompilationCompleted;
}
public async void HandleCompilationCompleted(IAsyncOperation<SpeechRecognitionResult> asyncInfo, AsyncStatus status)
{
var result = asyncInfo.GetResults();
string caso = result.Text;
if (result.Confidence != SpeechRecognitionConfidence.Rejected)
{
{
string recognizedText = result.Text;
// var dialog2 = new Windows.UI.Popups.MessageDialog(result.Text);
// await dialog2.ShowAsync();
resp = resp+ result.Text;
reco.Timeouts.EndSilenceTimeout = TimeSpan.FromSeconds(1.2);
};
var dialog2 = new Windows.UI.Popups.MessageDialog(resp);
await dialog2.ShowAsync();
}
// }
}