Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: Database: MS SQL Server
 SQL for Subscription Cleanup
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bitwise2000
Starting Member

38 Posts

Posted - 16 October 2006 :  18:02:18  Show Profile
I'd like to purge all subscriptions older than a particular date for members who are not mods or admins. Anyone have an SQL statement for that? Otherwise, I'll write one and post it. THANKS!

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 17 October 2006 :  04:17:14  Show Profile
You will not be able to do it my date as the date is not stored in the SUBSCRIPTIONS table.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

bitwise2000
Starting Member

38 Posts

Posted - 18 October 2006 :  23:22:36  Show Profile
Yes, it can be done by date. It just takes a join or subquery on the topics table. Here's an example that deletes all subscriptions to topics which have not had a post since Jan 1, 2006.

DELETE FROM Forum_Subscriptions
WHERE Subscription_ID IN
(SELECT S.Subscription_ID
FROM Forum_Subscriptions S
LEFT JOIN Forum_Topics T
ON S.Topic_ID=T.Topic_ID
WHERE T.T_Last_Post<20060101000000
AND S.Member_ID NOT IN
(Select M.Member_ID from Forum_Members M where M.M_Level>1))

I'll post the rest of my subscription cleanup queries next week. Maybe someone can use...
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 19 October 2006 :  03:57:19  Show Profile
Ah, OK - misunderstood what you were trying to do


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 19 October 2006 :  04:56:58  Show Profile  Visit HuwR's Homepage
I think I read it like you did Shaggy, I also though he wan't to delete subscriptions older than a particular date rather than subscriptions to topics that were older than a particular date

Please feel free to post your finished query bitwise2000
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 19 October 2006 :  05:05:34  Show Profile
Ay, that's what I thought was being asked.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

bitwise2000
Starting Member

38 Posts

Posted - 23 October 2006 :  18:09:06  Show Profile
I did indeed state poorly what I was trying to do. Thanks
Go to Top of Page

bobby131313
Senior Member

USA
1163 Posts

Posted - 23 October 2006 :  20:01:13  Show Profile  Visit bobby131313's Homepage


This would be a good to have. I hate that the "all subscriptions" page gets so large and cluttered. Probably doesn't really hurt anything, but I'm anal.

I found a new subscription page that's awesome, it has check boxes so that you can delete many at once. It has a date for each topic, but its the topic creation date, not the last post date, which would be awesome.


Switch the order of your title tags
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07