通过子查询选择top n是行不通的 [英] selecting top n via a subquery isn't working
本文介绍了通过子查询选择top n是行不通的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用的SQL语句是 -
展开 | 选择 | Wrap | 行号
解决方案
嗨
我想我可能会尝试一下这个
展开 | 选择 | 换行 | 行号
< blockquote>感谢您的回复。
您建议的陈述给出了奇怪的输出!对于一个bird_id,它已经复制了每个记录6次 - 现在只有一个bird_id。
即。
bird_id,date
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
我尝试在子查询中使用GROUP BY函数也无济于事。我真的坚持这个并将继续搜索谷歌。
Lizy
在没有任何数据知识的情况下很难知道你是什么期待。
我假设其他三个领域也都被重新调整!!
MTB
The SQL statement I am using is -
Expand|Select|Wrap|Line Numbers解决方案Hi
I think I might try it likr this
Expand|Select|Wrap|Line Numbers
Thank you for replying.
The statement you suggested has given a bizarre output! For a single bird_id it has duplicated each record 6 times - there is now only one bird_id.
ie.
bird_id, date
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 01/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
1 02/01/2001
I tried using a GROUP BY function within the subquery to no avail either. I am really stuck on this and will continue to search google.
Lizy
Without any knowledge of you data it is hard to know what you are expecting.
I assume the other three fields are also retuned also!!
MTB
这篇关于通过子查询选择top n是行不通的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文登录 关闭
扫码关注1秒登录发送“验证码”获取 | 15天全站免登陆