1,Swift中类可以使用计算属性,即使用get和set来间接获取/改变其他属性的值,代码如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class Calcuator{ var a:Int = 1; var b:Int = 1; var sum:Int{ get{ return a + b } set(val){ b = val
获取分组后取某字段最大一条记录 方法一:(效率最高) select * from test as a where typeindex = (select max(b.typeindex) from test as b where a.type = b.type ); 方法二:(效率次之) select a.* from test a, (select type,max(typeindex) typeindex from test group by type) b where a.type = b