尽量别直接用 DBObject ,Spring data mongodb 的api 本来就没什么多大用处,如果还直接用 DBObject 那么还需要自己去解析结果,说动做个对象映射,累不累 Spring data mongodb 唯一好处就是,不需要自己decode encode,其他别的几乎也没了 DBObject project = new BasicDBObject("$project", new BasicDBObject("_id", 1) .appen…
同一张表存在类似多级菜单的上下级关系的数据,查询出符合条件的某些数据的id拼接成一个字段返回: SELECT CONCAT(a.pid, ',', b.subid) AS studentIDS FROM (SELECT id as pid, sourceCode as scode FROM student WHERE studentType='父级条件1' AND studentCode='父级条件2') a LEFT JOIN (SELECT id as subid, parentCode p…
Select * from Student Select * From Course Select * from SC --子查询 低于总平均成绩的女同学成绩 Select Grade from Student, SC Where Student.Sno = SC.Sno and Student.Sex = '女' and Grade < (Select AVG(Grade) from SC) --(1).把低于总平均成绩的女同学成绩提高5% Update SC +0.05) From SC,…