请更正我的疑问 [英] Please correct my query

查看:58
本文介绍了请更正我的疑问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

Iam尝试从桌面中选择用户和用户数。

以下是我的查询。

  SELECT 用户名,mobileno,count(用户名) AS  count 
FROM table
GROUP BY userid
HAVING count(用户名)< = 5
ORDER BY count DESC







以上代码返回错误

请有人纠正我...

解决方案

你没有提到错误。但是我猜你需要在 Group By 语句中包含mobileno,因为你在select语句中使用它。因此,您更新的查询将是:

  SELECT 用户名,mobileno,count(用户名) AS  count 
FROM table
GROUP BY userid,mobileno
HAVING count(username)< = 5
ORDER BY count DESC


Hi
Iam trying to select a users and count of users from a table.
Below is my query.

SELECT username,mobileno, count( username) AS count
FROM table
GROUP BY userid
HAVING count( username) <=5
ORDER BY count DESC




The above code returns me Error
Please anyone correct me...

解决方案

You haven;t mentioned the error. But I guess you will need to include mobileno in Group By statement as you are using it in the select statement. So your updated query will be:

SELECT username,mobileno, count( username) AS count
FROM table
GROUP BY userid, mobileno
HAVING count( username) <=5
ORDER BY count DESC


这篇关于请更正我的疑问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆