charlesk
01-23-2005, 12:55 PM
Hey all,
I am attempting to modify the excellent "most recent threads" hack so that threads that were just responded to by someone on the ignore list are not shown. Before changing the code I am trying to figure out what SQL I need, so I have been testing with direct queries.
The closest I have gotten is this:
select post.*, thread.* from post,thread where post.userid not in ('275','135','1') AND post.threadid = thread.threadid order by post.dateline desc
In this case the "('275','135','1')" are the three sample user IDs I am "ignoring".
This works.. but the problem is that because it orders by posts, if there is more than one recent response to the same thread, the thread appears twice. I can't figure out how to get it to show only one thread no matter how many recent posts it has.
Can anyone help?
Thanks.
I am attempting to modify the excellent "most recent threads" hack so that threads that were just responded to by someone on the ignore list are not shown. Before changing the code I am trying to figure out what SQL I need, so I have been testing with direct queries.
The closest I have gotten is this:
select post.*, thread.* from post,thread where post.userid not in ('275','135','1') AND post.threadid = thread.threadid order by post.dateline desc
In this case the "('275','135','1')" are the three sample user IDs I am "ignoring".
This works.. but the problem is that because it orders by posts, if there is more than one recent response to the same thread, the thread appears twice. I can't figure out how to get it to show only one thread no matter how many recent posts it has.
Can anyone help?
Thanks.