试试这个 http://www.orafaq.com/forum/t/52844/2/You have a double quotation (") at the end of this line that does not belong there:A.RELATIONSHIP_PARTY_ID CONTACT_ID, A.CUSTOMER_PARTY_ID CUSTOMER_ID, " This may not be the only additional error, since you have not provided create table statements for your data structures for testing. It also helps if you provide a copy and paste of the actual run, including all error messages. The error code should be accompanied by the line that raised the error with an asterisk underneath the point in that line where the error was raised. Please see the sticky at the top of the forum for what we expect.
还是一样的错误,这是我的语句SELECT SUM(P) AS TP, SUM(RS) AS TRS, SUM(RS)/SUM(P) AS JLXS, MAX(QIN) AS FRMQ, (SELECT YMDH FROM TBL_FRPC WHERE FRID='a' AND QIN=(SELECT MAX(QIN) FROM TBL_FRPC WHERE FRID='a') AND ROWNUM<=1) AS FRMQD, (SELECT PA FROM TBL_FRPR WHERE FRID='a') AS PA FROM TBL_FRPC WHERE FRID='a' GROUP BY FRID
SELECT FRID,--这里加id,用于group SUM(P) AS TP, SUM(RS) AS TRS, SUM(RS)/SUM(P) AS JLXS, MAX(QIN) AS FRMQ, (SELECT YMDH FROM TBL_FRPC WHERE FRID='a' AND QIN=(SELECT MAX(QIN) FROM TBL_FRPC WHERE FRID='a') AND ROWNUM<=1) AS FRMQD,
(SELECT PA FROM TBL_FRPR WHERE FRID='a') AS PA FROM TBL_FRPC WHERE FRID='a' GROUP BY FRID--sql语句中有聚合函数时,group by后面的字段只能是不在聚合函数中的字段试试这样
http://www.orafaq.com/forum/t/52844/2/You have a double quotation (") at the end of this line that does not belong there:A.RELATIONSHIP_PARTY_ID CONTACT_ID, A.CUSTOMER_PARTY_ID CUSTOMER_ID, " This may not be the only additional error, since you have not provided create table statements for your data structures for testing. It also helps if you provide a copy and paste of the actual run, including all error messages. The error code should be accompanied by the line that raised the error with an asterisk underneath the point in that line where the error was raised. Please see the sticky at the top of the forum for what we expect.
(SELECT YMDH FROM TBL_FRPC WHERE FRID='a'
AND QIN=(SELECT MAX(QIN) FROM TBL_FRPC WHERE FRID='a')
AND ROWNUM<=1) AS FRMQD, (SELECT PA FROM TBL_FRPR WHERE FRID='a') AS PA
FROM TBL_FRPC WHERE FRID='a' GROUP BY FRID
FRID,--这里加id,用于group
SUM(P) AS TP,
SUM(RS) AS TRS,
SUM(RS)/SUM(P) AS JLXS,
MAX(QIN) AS FRMQ, (SELECT YMDH FROM TBL_FRPC WHERE FRID='a'
AND QIN=(SELECT MAX(QIN) FROM TBL_FRPC WHERE FRID='a')
AND ROWNUM<=1) AS FRMQD,
(SELECT PA FROM TBL_FRPR WHERE FRID='a') AS PA FROM TBL_FRPC WHERE FRID='a' GROUP BY FRID--sql语句中有聚合函数时,group by后面的字段只能是不在聚合函数中的字段试试这样