mysql查询选择后删除记录..?

时间:2018-11-19 07:48:07

标签: mysql select sql-delete

选择记录后,我想删除该记录。.我尝试了以下查询-(除去 public object ProvideValue() { if (Parameter is SampleData1) { return Parameter.GetData();//TODO: throw Exception("Parameter must be of type SampleData1") } else if (Parameter is SampleData2) { throw new Exception("Parameter must be of type SampleData1"); } return "error"; } 后,但显示-您无法在FROM子句中指定目标表'test'

,MAX(value)

1 个答案:

答案 0 :(得分:1)

您可以在下面尝试-您需要对内部select语句使用子查询

DELETE FROM test WHERE ext_no IN 
(
select ext_no from
(
SELECT   ext_no, MAX(value)
FROM     test
GROUP BY ext_no
HAVING   COUNT(*) > 2 AND 
         COUNT(*) = COUNT(CASE value WHEN 0 THEN 1 END)
)t)