-1

I found something thats look like what i'm searching but it's not : SQL selecting people you may know

I have a table of pictures, and a table of votes.

Votes (#id_pic, date, vote, ip, id_user)
Pic (#id, date ...)

So i'm trying to find other pictures that i may also like based on others votes compared to my votes (optionnaly, if i can give a picture for reference to start with, it'll be great.)

We'll admit that my id_user is 1, and if possible by taking a Pic for reference.

I think all the queries will be based on the votes table. I really don't have an idea how to start or how to do it.. if someone can give me some help, i'll appreciate.

Thanks, really.

4

1 回答 1

2

您要做的是选择与 id_user 1 匹配的所有投票,然后获取这些记录的所有 id_pic。

现在您已经拥有了您投票的所有图片,请选择 id_user 不是 1 的所有 id_pics(这将为您提供对该图片投票的所有其他用户)。

最后抓取 id_user 为 2(或其他数字)的所有 id_pics。

这个过程会占用大量资源,因此您可以考虑只为一张照片执行此操作。

于 2012-08-21T17:58:31.757 回答