sql判断存在优化

#### SQL写法:
SELECT 1 FROM table WHERE a = 1 AND b = 2 LIMIT 1

#### Java写法:
Integer exist = xxDao.existXxxxByXxx(params);
if ( exist != NULL ) {
  //当存在时,执行这里的代码
} else {
  //当不存在时,执行这里的代码
}

 转载:https://mp.weixin.qq.com/s/hLVKtsMWyGDAXV2mAP5s-w

原文地址:https://www.cnblogs.com/xr210/p/13291588.html