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
beast (55m) : What does the weather look like?
Martha Careful (5h) : You can wear long-johns mittens and a hat. We want Hill and their other skill guys FROZEN
Zero2Cool (9h) : I'm not sure I hope for that. I'll be at the game.
Martha Careful (23h) : I hope it is colder than a well-diggers ass on Thanksgiving night.
Zero2Cool (25-Nov) : doubt he wants to face the speedsters
beast (25-Nov) : Dolphins offense can be explosive... I wonder if we'll have Alexander back
Zero2Cool (25-Nov) : No Doubs could be issue Thursday
Mucky Tundra (25-Nov) : Bears. Santos. Blocked FG
Zero2Cool (24-Nov) : Bears. Vikings. OT
Mucky Tundra (24-Nov) : Thems the breaks I guess
Mucky Tundra (24-Nov) : Two players out and Williams had an injury designation this week but Oladapo is a healthy scratch
Zero2Cool (24-Nov) : Packers inactives vs 49ers: • CB Jaire Alexander • S Kitan Oladapo • LB Edgerrin Cooper • OL Jacob Monk
TheKanataThrilla (24-Nov) : Aaron Jones with a costly red zone fumble
Zero2Cool (24-Nov) : When we trade Malik for a 1st rounder, we'll need a new QB2.
packerfanoutwest (23-Nov) : Report: Aaron Rodgers wants to play in 2025, but not for the Jets
beast (23-Nov) : That's what I told the Police officer about my speed when he pulled me over
packerfanoutwest (23-Nov) : NFL told Bears that Packers’ blocked field goal was legal
packerfanoutwest (22-Nov) : 49ers are underdogs at Packers, ending streak of 36 straight games as favorites
Zero2Cool (22-Nov) : 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.
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
now / Green Bay Packers Talk / Mucky Tundra

1h / Featured Content / wpr

1h / Green Bay Packers Talk / wpr

3h / Green Bay Packers Talk / Zero2Cool

25-Nov / Green Bay Packers Talk / Zero2Cool

25-Nov / Green Bay Packers Talk / buckeyepackfan

24-Nov / Green Bay Packers Talk / buckeyepackfan

24-Nov / GameDay Threads / Zero2Cool

23-Nov / Green Bay Packers Talk / dfosterf

23-Nov / Green Bay Packers Talk / Zero2Cool

21-Nov / Green Bay Packers Talk / Martha Careful

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 / beast

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