【发布时间】:2015-06-09 12:17:53
【问题描述】:
这些是我的表 table1 的字段(位置、俱乐部、国家、国旗)和
我需要随机显示俱乐部名称而不重复国家,
使用这个查询
select top 4 position
from table1 where flag = 0
and exists(select distinct country from table1) order by newid()
但结果却重复了国家名称,
你能帮帮我吗?
谢谢你,
上午
【问题讨论】:
-
您使用的是哪个 DBMS?后格雷斯?甲骨文?
-
exists(select distinct...应该完成什么? -
你的意思是你想从每个国家随机挑选一个俱乐部?
-
请提供样本数据和期望的结果,并用您正在使用的数据库标记您的问题。