sql 对应 sequelize
2016-02-29 14:32
495 查看
sequelize调用distinct函数
xx.xx.findAll({where:begin_date,attributes:['DISTINCT `nb_id`']},SqlQureyFormat).complete(function(dberr, dbresult) {
}}
sql:SELECT DISTINCT `nb_id` FROM `xx` WHERE 1=1;
sequelize调用ORDER BY函数
xx.xx.findAll({where:{},'order': [['create_time', 'DESC']]},SqlQureyFormat).complete(function(dberr, dbresult) {
})
sql:SELECT * FROM `xx` WHERE 1=1 ORDER BY `create_time` DESC;
sequelize获取重复数据
})
sql:SELECT `nb_id`,count(nb_id) as count FROM `xx` WHERE 1=1 GROUP BY `nb_id` having count>1;
xx.xx.findAll({where:begin_date,attributes:['DISTINCT `nb_id`']},SqlQureyFormat).complete(function(dberr, dbresult) {
}}
sql:SELECT DISTINCT `nb_id` FROM `xx` WHERE 1=1;
sequelize调用ORDER BY函数
xx.xx.findAll({where:{},'order': [['create_time', 'DESC']]},SqlQureyFormat).complete(function(dberr, dbresult) {
})
sql:SELECT * FROM `xx` WHERE 1=1 ORDER BY `create_time` DESC;
sequelize获取重复数据
xx.xx.findAll({where:{},'group': [['nb_id', 'having count>1']],attributes:['`nb_id`,count(nb_id) as count']},SqlQureyFormat).complete(function(dberr, dbresult) {
})
sql:SELECT `nb_id`,count(nb_id) as count FROM `xx` WHERE 1=1 GROUP BY `nb_id` having count>1;
相关文章推荐
- UIKit框架(10)自定义modal过渡效果
- 如何为UICollectionView添加整体的header view
- 事务Transaction()详解(以及ContentValue的注意点)
- iOS7——UIControlEventTouchDown延迟响应问题
- UIKit框架(9)控制器的modal切换方式(二)
- 简单的计时器动画实现-ValueAnimator
- UINavigationController之NavigationBar
- QT QPixmap:It is not safe to use Pixmaps outside the GUI thread
- UIKit框架(9)控制器的modal切换方式(一)
- codeforces 446A DZY Loves Sequences
- Confluence简介
- 腾讯精品文!超多干货的UI界面动效设计指南
- 国内UED网站大全
- iOS 中很多字体字符串UIFont
- UIViewAlertForUnsatisfiableConstraints
- UIKit框架(8)屏幕适配(二)
- 理解 Android Build 系统
- UITableView刷新指定section、cell
- 关于开源框架GPUImage 的简单说明
- UIKit框架(8)屏幕适配(一)