这个 sql 语句 怎么写的?
SELECT N.ID,M.TITLE,N.SUBMIT_TIME,N.STATE ,N.CATEGORY_ID FROM BB_FORM_MODEL_CATEGORY M , ( " + "SELECT * FROM BB_FORM_MODEL_PROCESS T1 , " + "(" +"SELECT MAX(PROCESS_STEP) AS MAXINDEX, T.CATEGORY_ID AS IDX FROM BB_FORM_MODEL_PROCESS_COLUMN T," +
"(SELECT T2.CATEGORY_ID FROM BB_FORM_MODEL_PROCESS_COLUMN T2 WHERE (T2.GROUP_ID = 0 OR T2.GROUP_ID <= " +
this.getGroupId() + ") AND T2.USER_ID = " + this.getUserId() + ") B " +
"WHERE T.CATEGORY_ID = B.CATEGORY_ID GROUP BY T.CATEGORY_ID ) A " +
"WHERE A.MAXINDEX = T1.STATE AND A.IDX = T1.CATEGORY_ID ) N WHERE M.ID = N.CATEGORY_ID
这种的语句是怎么写的?我看了半天就是没看懂。。。。。。。。知道的 帮帮忙 写个简单一点的例子? O(∩_∩)O~
这种效率比用login好吗?为什么?
------解决方案--------------------这个不是从java里直接贴出来的吧。。。。
------解决方案--------------------明显就是在拼接sql串!
------解决方案--------------------select a.* ,(select id from b)...
这样做是因为,不用做笛卡尔积。先把b中的id放内存中
------解决方案--------------------