に基づいてデータをロードするためにMySQLのクエリcase文コンディション
SELECT task.id,task.Task,task.TaskCategory,task.IsComplete,
task.AssignedDate,task.CompletionDate, task.AssignedTo,task.templateID,task.ListingID,task.ClosingID,
task.ContactID,task.LeadID,task.statusid, taskcategory.taskCategoryID,taskcategory.Category FROM
task INNER JOIN taskcategory ON task.TaskCategory = taskcategory.taskCategoryID WHERE 1=1
and (CompletionDate = CURDATE() OR CompletionDate IS NULL AND task.IsComplete = 0)
and assignedto = 2345 and id = 2421 and
CASE(WHEN status_for_design = 0 THEN (leadid is not null or ContactID is not null)
THEN NULL
END AS status_for_design)
group by
assignedto ORDER BY task.AssignedDate ASC
主な目的は= status_for_design = 0 [利用leadidまたはcontactidがnullでない場合ですが、status_for_design場合1
が、私はNO、あなたがそのようなWHERE
句でCASE
条件を含めることはできませんエラー
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHEN status_for_design = 0 THEN (leadid is not null or ContactID is not null)
T' at line 7