我试图只显示多个人在我的表格中的zipcodes并按升序排序。
我尝试了以下但是它不起作用。
SELECT zipcode AS "zipcodes" FROM people GROUP BY zipcode ORDER BY ASC;
答案 0 :(得分:1)
<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="index.aspx" />
</authentication>
<authorization>
<allow users="*"/>
</authorization>
如果您只需要在订单之前附加2次以上的邮政编码:
HttpContext.Current.User.Identity.IsAuthenticated
或者(如果Mysql支持HAVING子句中的别名):
SELECT zipcode AS "zipcodes", count(1) as ZIP_COUNT
FROM people
GROUP BY zipcode
ORDER BY ZIP_COUNT ASC;
答案 1 :(得分:0)
您的查询的主要问题是您没有按部分指定订单中的任何列。
SELECT zipcode AS "zipcodes" FROM people GROUP BY zipcode ORDER BY ASC;
所以只需将zipcode添加到它就可以了。
SELECT zipcode AS "zipcodes" FROM people GROUP BY zipcode ORDER BY zipcode ASC;
答案 2 :(得分:0)
以下查询选择表“people”中包含多个条目的邮政编码:
SELECT zipcode AS "zipcodes"
FROM people
GROUP BY zipcode
HAVING COUNT(*) > 1
ORDER BY zipcode ASC;
答案 3 :(得分:0)
尝试这个
SELECT zipcode AS "zipcodes", count(zipcode) as noofzip
FROM people
GROUP BY zipcode
having count(zipcode)>1
order by zipcode