UNION 查询-按照查询写入的顺序显示结果
示例 -
select * from discussion where title like '%india%'
UNION
select * from discussion where title like '%Australia%'
它按讨论 ID 的顺序显示混合两种类型结果的结果
我想首先显示印度结果,然后显示澳大利亚结果,并且我无法使用选项 ALl,因为我还需要删除重复的行。
应该做什么?
example -
select * from discussion where title like '%india%'
UNION
select * from discussion where title like '%Australia%'
It shows me results in order of discussion IDs mixing both typse of results
I want to display India results first then Australia's results and I cant use Option ALl as I need to remove duplicate rows also.
What should be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在
编辑 - 29/11/2010
上添加一列,由于 ORD 问题的重复,我正在考虑一种也许更优雅的方法来实现此目的
You could add a column to order on
EDIT - 29/11/2010
Due to the duplicate with ORD problem i was thinking about a, maybe, more elegant way to achive this
尝试:
Try: