这个查询语句应该如何写才正确

WBOY
Release: 2016-06-13 12:01:36
Original
913 people have browsed it

这个查询语句应该怎么写才正确
$sns=$db->field('DISTINCT(dname)' AS 'd_name','COUNT(dname)' AS 'tjs')->where(array('lid'=>intval($_GET['id']),'islottery'=>1))->GROUP('dname')->order('tjs DESC')->select();


------解决方案--------------------
DISTINCT 是关键字,而不是函数
不能这样用:DISTINCT(dname)
用了也没效果
但可以放在聚类函数中,比如 count(DISTINCT dname) 统计 dname 有多少种状态

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template