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
packerfanoutwest (7h) : 49ers are underdogs at Packers, ending streak of 36 straight games as favorites
Zero2Cool (14h) : 49ers might be down their QB, DL, TE and LT?
packerfanoutwest (22-Nov) : Jaire Alexander says he has a torn PCL
Zero2Cool (20-Nov) : Even with the context it's ... what?
Mucky Tundra (20-Nov) : Matt LaFleur without context: “I don’t wanna pat you on the butt and you poop in my hand.”
beast (20-Nov) : We brought in a former Packers OL coach to help evaluate OL as a scout
beast (20-Nov) : Jets have been pretty good at picking DL
Zero2Cool (20-Nov) : He landed good players thanks to high draft slot. He isn't good.
Zero2Cool (20-Nov) : He can shove his knowledge up his ass. He knows nothing.
beast (20-Nov) : More knowledge, just like bring in the Jets head coach
Zero2Cool (19-Nov) : What? Why? Huh?
beast (19-Nov) : I wonder if the Packers might to try to bring Douglas in through Milt Hendrickson/Ravens connections
Zero2Cool (19-Nov) : The Jets fired Joe Douglas, per sources
packerfanoutwest (19-Nov) : Jets are a mess......
Zero2Cool (19-Nov) : Pretty sure Jets fired their scouting staff and just pluck former Packers.
Zero2Cool (19-Nov) : Jets sign Anders Carlson to their 53.
Zero2Cool (19-Nov) : When you cycle the weeks, the total over remains for season. But you get your W/L for that selected week. Confusing.
packerfanoutwest (19-Nov) : the total and percentage are the same as the previous weeks
packerfanoutwest (19-Nov) : the total and percentage are the same as the previous weeks
packerfanoutwest (19-Nov) : the totals are accurate..nrvrtmind
Zero2Cool (19-Nov) : I don't follow what you are saying. The totals are not the same as last week.
packerfanoutwest (19-Nov) : ok so then wht are the totals the same as last week?
Zero2Cool (19-Nov) : NFL Pick'em is auto updated when NFL Scores tab is clicked
Martha Careful (19-Nov) : The offense was OK. Let's not forget the Bear defense is very very good.
packerfanoutwest (19-Nov) : Who updates the leaderboard on NFLPickem?
beast (19-Nov) : Has the Packers offense been worse since the former Jets coach joined the Packers?
Zero2Cool (19-Nov) : Offense gets his ass in gear, this could be good.
Zero2Cool (19-Nov) : Backup QB helped with three wins. Special Teams contributed to three wins.
bboystyle (18-Nov) : Lions played outside thats why. They scored 16 and 17 in the only 2 outside games this year
Zero2Cool (18-Nov) : The rest of the NFL is catching up to Packers ... kicking is an issue throughout league
packerfanoutwest (18-Nov) : Packers DL Kenny Clark: We knew 'we were going to block' Bears' game-winning field goal attempt
Zero2Cool (18-Nov) : Lions seem to be throttling everyone, but only (only) got 24 lol maybe the rain is why
Zero2Cool (18-Nov) : Packers vs Lions game doesn't seem so bad.
beast (18-Nov) : Dennis Green "They are what we thought they were, and we let them off the hook!"
Martha Careful (17-Nov) : comment of the day Z2Cool "Bears better than we want to admit. Packers worse than we think. It's facts."
Mucky Tundra (17-Nov) : my worst case scenario: Bears fix their oline and get a coach like Johnson from the Lions and his scheme
Zero2Cool (17-Nov) : Bears get OL fixed amd we might have a problem
buckeyepackfan (17-Nov) : Pretty sure they already have scouting reports on guys who aren't even starting for their college team. The future is now for me.
buckeyepackfan (17-Nov) : I tend to let Gute and Co. Worry about the future.
beast (17-Nov) : That's great news and Packers need to keep upgrading their OL, DL and DBs this off-season, so missing one guy doesn't kill them
beast (17-Nov) : That's great news and Packers need to keep upgrading their OL, DL and DBs this off-season, so missing one guy doesn't kill them
buckeyepackfan (17-Nov) : Jaire and Evans Williams are both ACTIVE! Good news.
Martha Careful (17-Nov) : The badgers really need to change the whole offensive scheme. No draws no screens plus the quarterback is marginal
Cheesey (17-Nov) : If the Badgers had a decent QB, they would have won. The guy can't hit a wide open receiver
Martha Careful (17-Nov) : chop block
Martha Careful (17-Nov) : there was a very questionable job Block call that upon viewing replay was very borderline
beast (17-Nov) : How so? (I didn't watch)
Zero2Cool (17-Nov) : Badgers got hosed vs Oregon
packerfanoutwest (16-Nov) : damn,he hasn't played since week 2
Mucky Tundra (15-Nov) : poor guy can't catch a break
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 @ 12:00 PM
Vikings
Saturday, Jan 4 @ 11:00 PM
BEARS
Recent Topics
59m / Green Bay Packers Talk / wpr

16h / Green Bay Packers Talk / Martha Careful

21-Nov / Green Bay Packers Talk / Martha Careful

21-Nov / Green Bay Packers Talk / Zero2Cool

21-Nov / Green Bay Packers Talk / Zero2Cool

21-Nov / Green Bay Packers Talk / Zero2Cool

21-Nov / Green Bay Packers Talk / beast

20-Nov / Green Bay Packers Talk / Zero2Cool

20-Nov / Green Bay Packers Talk / Zero2Cool

20-Nov / Green Bay Packers Talk / beast

20-Nov / Green Bay Packers Talk / wpr

19-Nov / Green Bay Packers Talk / dfosterf

19-Nov / Featured Content / Zero2Cool

19-Nov / Green Bay Packers Talk / Martha Careful

19-Nov / Green Bay Packers Talk / wpr

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