MS Access 2003 连接内的随机记录
我试图从连接中获取随机记录,但我无法让它工作!有什么想法吗?它使用 Microsoft Access 2003。
table = members
===============
memberID int
name varchar
table = testimonials
====================
testimonialID int
memberID int
content memo
select m.*, (SELECT t.content from testimonials t where t.memberID=m.memberID ORDER BY rnd(t.testimonialID)) as testimonialtext
FROM members m;
我基本上需要每个会员记录和该会员的一份随机推荐。我还应该补充一点,我也在连接中尝试过......
select m.*, t.content FROM members m
INNER JOIN testimonials t ON m.memberID=t.memberID
ORDER BY rnd(t.testimonialID)
感谢您的帮助。
I am trying to get a random record from a join, but I cannot get it to work! Any ideas? It's using Microsoft Access 2003.
table = members
===============
memberID int
name varchar
table = testimonials
====================
testimonialID int
memberID int
content memo
select m.*, (SELECT t.content from testimonials t where t.memberID=m.memberID ORDER BY rnd(t.testimonialID)) as testimonialtext
FROM members m;
I basically need each member record and one random testimonial for that member. I should also add that I've tried it within a join too...
select m.*, t.content FROM members m
INNER JOIN testimonials t ON m.memberID=t.memberID
ORDER BY rnd(t.testimonialID)
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试用 TOP 子句来限制
,然后我们可以这样做:
try to limit with TOP clause
ok, then we can do something like: