急 帮我看下这个SQL语句对或者错了 在线等
select A.id,A.payer,A.state,A.path,A.acceptanceid,A.ispay,A.ordercontentid,A.dispose,B.tempId,B.ID,B.wktmps,B.metas
FROM CA_ORDER_INFO A,CA_ORDER_CONTENT B WHERE B.ID = (select CA_ORDER_INFO.ORDERCONTENTID FROM CA_ORDER_INFO where ISPAY=0 and STATE=0)
感觉就像是错了
就是 通过 (select CA_ORDER_INFO.ORDERCONTENTID FROM CA_ORDER_INFO where ISPAY=0 and STATE=0)得到符合标准的 ORDERCONTENTID 然后再从另外一个表中利用ORDERCONTENTID=*。ID 取出相关数据的SQL语句
------解决方案--------------------
select A.id,A.payer,A.state,A.path,A.acceptanceid,A.ispay,A.ordercontentid,A.dispose,B.tempId,B.ID,B.wktmps,B.metas
FROM CA_ORDER_INFO A,CA_ORDER_CONTENT B ,(select CA_ORDER_INFO.ORDERCONTENTID FROM CA_ORDER_INFO where ISPAY=0 and STATE=0)C WHERE B.ID = C.ORDERCONTENTID
------解决方案--------------------
SQL code
SELECT A.ID,
A.PAYER,
A.STATE,
A.PATH,
A.ACCEPTANCEID,
A.ISPAY,
A.ORDERCONTENTID,
A.DISPOSE,
B.TEMPID,
B.ID,
B.WKTMPS,
B.METAS
FROM CA_ORDER_INFO A, CA_ORDER_CONTENT B
WHERE B.ID = A.ORDERCONTENTID
AND A.ISPAY = 0
AND A.STATE = 0