我编写了以下 sql 查询来获取当前用户 IP 看不到的视频。但是我总是没有视频。这是我的代码
SELECT views_videos.Vid_URL,views_videos.Vid_Owner,views_videos.Vid_Points,
views_videos.Vid_ID
FROM members
JOIN views_videos
ON members.member_id=views_videos.Vid_Owner
JOIN videoed_video
ON views_videos.Vid_ID = videoed_video.VID_ID
where
views_videos.IsEnable='yes' AND members.points > 15
AND members.account_stat = 'active'
AND views_videos.Vid_Limit >= views_videos.views_sovar
AND views_videos.Vid_Daily >= views_videos.today_view
AND videoed_video.view_Date NOT BETWEEN '$yesterDayTimeStamo' AND '$todayTimestamp'
AND videoed_video.view_IP != '$ip'
order by views_videos.Vid_Points DESC,rand() limit 1
我多次重写代码,我花了一个月的时间来尝试解决这个问题。在上面的查询中,我加入了 3 个表,然后尝试应用一些条件来获取当前用户 IP 看不到的视频,但我没有从查询中得到任何结果。