0

oracle 显示错误:ora-00907 缺少右括号

SELECT EQUIPMENT_ID
    FROM IRRI_EQUIPMENT_STATUS_CHANGE
   WHERE ID IN(SELECT MAX (ID)
                    FROM IRRI_EQUIPMENT_STATUS_CHANGE
                   WHERE STAUS_YEAR_MONTH <= 105
                GROUP BY EQUIPMENT_ID, STAUS_YEAR_MONTH
                ORDER BY MAX (ID) ASC, STAUS_YEAR_MONTH DESC)
ORDER BY EQUIPMENT_ID
4

1 回答 1

1

ORDER BYinIN子句查询不是必需的,而且它没有任何作用并引发错误。

您的查询应如下所示:

SELECT EQUIPMENT_ID
    FROM IRRI_EQUIPMENT_STATUS_CHANGE
   WHERE ID IN(SELECT MAX (ID)
                    FROM IRRI_EQUIPMENT_STATUS_CHANGE
                   WHERE STAUS_YEAR_MONTH <= 105
                GROUP BY EQUIPMENT_ID, STAUS_YEAR_MONTH)
ORDER BY EQUIPMENT_ID

干杯!!

于 2019-08-31T06:03:08.067 回答