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) {
})
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;