日期:2014-05-17 浏览次数:20599 次
SELECT * FROM ( SELECT ... FROM ca_applicant_info cai , ca_order_info coi WHERE coi.USERID = cai.id AND coi.ispay = 1 AND coi.delflag = 0 AND coi.state = 0 ORDER BY createdate DESC --写到这儿 ) wk WHERE wk.rn > 0 AND wk.rn <= 2
------解决方案--------------------
SELECT *
FROM (SELECT Cai.*,Coi.* ,row_number()over(ORDER BY Cai/Coi.Createdate) rn
FROM Ca_Applicant_Info Cai, Ca_Order_Info Coi
WHERE Coi.Userid = Cai.Id
AND Coi.Ispay = 1
AND Coi.Delflag = 0
AND Coi.State = 0
) Wk
WHERE Wk.Rn > 0
AND Wk.Rn <= 2
--ORDER BY Createdate DESC
------解决方案--------------------
不是太明确lz的问题点。
还是请LZ 给表结构,数据,和要求的结果样式吧。
------解决方案--------------------