@DBref文档关联,在按该类型查询的时候,在字段名后加上关联表的字段名即可,如: Criteria.where("bloggroup.$id"), $id代表关联表的oid字段. or和and联合查询 比如查询 (A = 1 and b = 2 )or (A = 3 and b =4),or的数量不确定, 那么采用定义一个Criteria数组,将条件组记入数组中,然后将数组指定给orCriteria方法. @Override public List<Blog> find(…
今天有网友群里提了这样一个关于SQL联合查询的需求: 一.有热心网友的方案: 二.我的方案: select * from ( select a.*,(select top 1 Id from B as b where b.CgId =a.ID)as bid from A as a ) as temp left join B as b2 on temp.bid=b2.Id…
select * from t1 left join t2 on t2.sysno =t1.ASysNo left join t3 on t3.sysno =t2.ASysNo left join t4 on t4.sysno =t3.ASysNo left join t5 on t5.sysno =t4.ASysNo left join t6 on t6.sysno =t5.ASysNo left join t7 on t7.sysno =t6.ASysNo where t1.name lik…