Zero2Cool
14 years ago
I'm trying to clean up the database.

My goal is to remove the posts from members that have been deleted.

I want a select statement that shows me how many of them there are before deleting.


I think I'll be using three tables with this.

table (field)
[ul]users (user_id)
posts (poster_id)
posts_text (post_id)[/ul]

Every post is given and id number. Then that id number is assigned to the post text.

The relationship between users and posts is the user_id and poster_id.
The relationship between posts and posts_text is the post_id.

I tried this, but it didn't work so well.

[php]SELECT *
FROM posts LEFT JOIN users
ON posts.poster_id != users.user_id[/php]


I think I caused some site load errors with this query too, lol.
UserPostedImage
dhpackr
14 years ago
bummer you can't delete posts
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
dhpackr
14 years ago
don't you want to use count

SELECT posts, COUNT(*) FROM posts WHERE Posterid=poster_id GROUP BY poster_id;

you have to play around with the table names, and you add quite a bit to a query with 'where' & 'group by' as well as 'orderby'

just running a select or count query should not break the site
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Zero2Cool
14 years ago
I dunno, do I?
UserPostedImage
dhpackr
14 years ago
you know the answer, just play around till you get the query.

wanna let me in?

i'll try
otherwise this will help 
So if you meet me Have some courtesy, Have some sympathy, and some taste
Use all your well-learned politesse, Or I'll lay your soul to waste
Nonstopdrivel
14 years ago
I'm confused. Are you wanting to clean up deleted posts or posts by deleted members? The owner of the other board I used to administrate did the latter routinely; unfortunately, some of the most prolific members (e.g., instructors) were getting deleted. This resulted in some of our best threads being rendered nearly indecipherable, with members responding to phantom statements and questions. Threads came to resemble Swiss cheese, with much of the best content missing, rendering them all but useless. If this is what you want to do, I'd urge caution in implementing it.
UserPostedImage
Zero2Cool
14 years ago
627 posts returned.


Every post should have a valid relationship to a member.
Every topic should have a valid relationship to a post.
Every post should have a valid relationship to a topic.

I don't want rogue data out there.
UserPostedImage
Pack93z
14 years ago
Yes use the count, cleaner approach for your request in the first post.. as a review.
"The oranges are dry; the apples are mealy; and the papayas... I don't know what's going on with the papayas!"
Pack93z
14 years ago
Okay.. with the timeout error, more than likely due to query gen, my comment now seems out of place. lol.
"The oranges are dry; the apples are mealy; and the papayas... I don't know what's going on with the papayas!"
Zero2Cool
14 years ago
627 is what I got back, which is just a list of members who have 1 or more posts.

The member list shows 618 with a post.

That to me means we have posts for 9 members that have been deleted.
UserPostedImage
Fan Shout
Zero2Cool (2-Apr) : WR who said he'd break Xavier Worthy 40 time...and ran slower than you
Mucky Tundra (2-Apr) : Who?
Zero2Cool (2-Apr) : Texas’ WR Isaiah Bond is scheduled to visit the Bills, Browns, Chiefs, Falcons, Packers and Titans starting next week.
Zero2Cool (2-Apr) : Spotting ball isn't changing, only measuring distance is, Which wasn't the issue.
Zero2Cool (2-Apr) : The spotting of the ball IS the issue. Not the chain gang.
Mucky Tundra (2-Apr) : Will there be a tracker on the ball or something?
Zero2Cool (1-Apr) : uh oh
Martha Careful (1-Apr) : Too bad camera's can't spot the ball as well.
Mucky Tundra (1-Apr) : So will the chain gang be gone completely or will they still be around as a backup or whatever?
Zero2Cool (1-Apr) : The method for measuring first downs in the NFL will switch from chain gangs to camera-based technology in 2025, the league announced.
Martha Careful (1-Apr) : A big step in the right direction. Just put in the college system is very very good.
Zero2Cool (1-Apr) : NFL has passed a rule that allows both teams to possess the ball in OT during the regular season
Zero2Cool (1-Apr) : Touchbacks on kickoffs will now bring the ball to the 35-yard line.
beast (31-Mar) : It might of gotten more popular recently, but braiding hair (even men) in certain cultures goes back for centuries.
Martha Careful (30-Mar) : Is men braiding their hair a new style thing? Watching the NCAA men's tournament many players have done
Zero2Cool (29-Mar) : Ha. Well, it'd be nice for folks to reset their own password. Via validated email 😏
beast (29-Mar) : Monopoly was supposed to be an educational game, that show how evil capitalism was and how we should avoid it
beast (29-Mar) : Lol, I was thinking username would be better, as then I wouldn't have to keep an email up to date lol 😂
beast (29-Mar) : Zero2Cool (25-Mar) : I was thinking email because I think it'll make folks keep it up todate lol
wpr (29-Mar) : sure is
Zero2Cool (29-Mar) : Monopoly is a rip off of The Landlord's Game
wpr (27-Mar) : 28 days until the draft
earthquake (27-Mar) : Which seemed strange to my 9 year old self, that you could be a fan for a team other than the one you play for
earthquake (27-Mar) : Nothing eventful happened, other than it being clear that he was a bengals fan
earthquake (27-Mar) : And we went and hung out with him one afternoon, I must have been 9 or so
earthquake (27-Mar) : That’s wild, when I was a kid my friend lived in the same apartment complex in De Pere
Mucky Tundra (27-Mar) : Only career highspot was a 200 yard rushing game while playing for the Cardinals
Mucky Tundra (27-Mar) : He is a former Packer. Drafted out of Northern Illinois. Didn't do much in GB.
dfosterf (26-Mar) : Despicable
Zero2Cool (26-Mar) : Former NFL. I think Packers too
Zero2Cool (26-Mar) : NFL RB Leshon Johnson has been charged in a massive dog fighting operation, with the FBI seizing over 190 Pit Bulls
Mucky Tundra (26-Mar) : Some real irony of a QB as short as Wilson playing for the Giants
Mucky Tundra (26-Mar) : Giants country, let's be the tall beings of lore!
Mucky Tundra (26-Mar) : Russell Wilson signs with the Giants.
Zero2Cool (25-Mar) : I was thinking email because I think it'll make folks keep it up todate lol
wpr (25-Mar) : I don't think there is a significant difference. I use a user name for many. Others email.
Martha Careful (25-Mar) : email
Zero2Cool (25-Mar) : would it be better to use EMAIL or USERNAME to log into a site?
wpr (25-Mar) : Thanks Zero
Zero2Cool (24-Mar) : New forum has the ability to Thank a post now.
beast (24-Mar) : And the only time they have won the Championship in an even year, was the first time they did, in 2006.
beast (24-Mar) : Since 2007, there have been 10 odd numbered years, Wisconsin Women have won the Championship in 7 of those 10 odd numbered years.
buckeyepackfan (24-Mar) : Congratulations Lady Badger Hockey Team. NATIONAL CHAMPIONS!!
Zero2Cool (23-Mar) : I don't think it's completed yet. it was just announced last month, right?
dhazer (23-Mar) : did netflix ever release the Packers documentary
Zero2Cool (21-Mar) : And it is glorious!
beast (21-Mar) : Unsigned FA QB Rodgers is supposedly in the Steelers building
Martha Careful (19-Mar) : But I don't own a car! So can I still use it in my apartment?
Zero2Cool (19-Mar) : btw, new site auto updates
Zero2Cool (19-Mar) : Woohoo!
Please sign in to use Fan Shout
2024 Packers Schedule
Friday, Sep 6 @ 7:15 PM
Eagles
Sunday, Sep 15 @ 12:00 PM
COLTS
Sunday, Sep 22 @ 12:00 PM
Titans
Sunday, Sep 29 @ 12:00 PM
VIKINGS
Sunday, Oct 6 @ 3:25 PM
Rams
Sunday, Oct 13 @ 12:00 PM
CARDINALS
Sunday, Oct 20 @ 12:00 PM
TEXANS
Sunday, Oct 27 @ 12:00 PM
Jaguars
Sunday, Nov 3 @ 3:25 PM
LIONS
Sunday, Nov 17 @ 12:00 PM
Bears
Sunday, Nov 24 @ 3:25 PM
49ERS
Thursday, Nov 28 @ 7:20 PM
DOLPHINS
Thursday, Dec 5 @ 7:15 PM
Lions
Sunday, Dec 15 @ 7:20 PM
Seahawks
Monday, Dec 23 @ 7:15 PM
SAINTS
Sunday, Dec 29 @ 3:25 PM
Vikings
Sunday, Jan 5 @ 12:00 PM
BEARS
Sunday, Jan 12 @ 3:30 PM
Eagles
Recent Topics
2-Apr / Green Bay Packers Talk / Zero2Cool

2-Apr / Green Bay Packers Talk / bboystyle

1-Apr / Green Bay Packers Talk / Mucky Tundra

1-Apr / Green Bay Packers Talk / wpr

31-Mar / Green Bay Packers Talk / Zero2Cool

30-Mar / Green Bay Packers Talk / Zero2Cool

29-Mar / Random Babble / wpr

28-Mar / Feedback, Suggestions and Issues / dfosterf

28-Mar / Random Babble / Martha Careful

26-Mar / Random Babble / Mucky Tundra

25-Mar / Random Babble / Martha Careful

24-Mar / Random Babble / packerfanoutwest

24-Mar / Random Babble / Zero2Cool

21-Mar / Green Bay Packers Talk / Zero2Cool

19-Mar / Green Bay Packers Talk / Zero2Cool

Headlines
Copyright © 2006 - 2025 PackersHome.com™. All Rights Reserved.