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
Martha Careful (17h) : thank you Mucky for sticking up for me
Martha Careful (17h) : some of those people are smarter than you zero. However Pete Carroll is not
Mucky Tundra (20h) : Rude!
beast (21h) : Martha? 😋
Zero2Cool (24-Jan) : Raiders hired someone from the elderly home.
dfosterf (24-Jan) : I'm going with a combination of the two.
beast (24-Jan) : Either the Cowboys have no idea what they're doing, or they're targeting their former OC, currently the Eagles OC
Zero2Cool (23-Jan) : Fake news. Cowboys say no
Zero2Cool (23-Jan) : Mystery candidate in the Cowboys head coaching search believed to be Packers ST Coordinator Rich Bisaccia.
beast (23-Jan) : Also why do both NYC teams have absolutely horrible OL for over a decade?
beast (23-Jan) : I wonder why the Jets always hire defensive coaches to be head coach
Zero2Cool (22-Jan) : Still HC positions available out there. I wonder if Hafley pops up for one
Zero2Cool (22-Jan) : Trent Baalke is out as the Jaguars GM.
dfosterf (22-Jan) : Jeff Hafley would have been a better choice, fortunately they don't know that. Someone will figure that out next off season
Zero2Cool (22-Jan) : Aaron Glenn Planning To Take Jets HC Job
dfosterf (22-Jan) : Martha- C'est mon boulot! 😁
Zero2Cool (22-Jan) : Thank you
wpr (22-Jan) : Z, glad you are feeling better.
wpr (22-Jan) : My son and D-I-L work for UM. It's a way to pick on them.
Zero2Cool (22-Jan) : Thank you. I rarely get sick, and even more rarely sick to the point I can't work.
wpr (22-Jan) : Beast- back to yesterday, I CAN say OSU your have been Michigan IF the odds of making the playoffs were more urgent.
dfosterf (22-Jan) : Glad to hear you are feeling a bit better.
Zero2Cool (22-Jan) : I've been near death ill last several days, finally feel less dead and site issues.
Zero2Cool (22-Jan) : It is a big deal. This host is having issues. It's frustrating.
Martha Careful (22-Jan) : just kidding...it was down
Martha Careful (22-Jan) : you were blocked yesterday, due to a a recalcitrant demeanor yesterday in the penalty box for a recalcitrant demeanor
dfosterf (22-Jan) : Was that site shutdown on your end or mine? No big deal, just curious
beast (21-Jan) : That way teams like Indiana and SMU don't make the conference championships by simply avoiding all the other good teams in their own confere
beast (21-Jan) : Also, with these "Super Conferences" instead of a single conference champion, have 4 teams make a Conference playoffs.
beast (21-Jan) : Also in college football, is a bye week a good or bad thing?
Martha Careful (21-Jan) : The tournament format was fine. Seeding could use some work.
beast (21-Jan) : You can't assume Ohio State would of won the Michigan game...
beast (21-Jan) : Rankings were 1) Oregon 2) Georgia 3) Texas 4) Penn State 5) Notre Dame 6) Ohio State, none of the rest mattered
wpr (21-Jan) : Texas, ND and OSU would have been fighting for the final 2 slots.
wpr (21-Jan) : Oregon and Georgia were locks. Without the luxury of extra playoff berths, Ohios St would have been more focused on Michigan game.
wpr (21-Jan) : Zero, no. If there were only 4 teams Ohio State would have been one of them. Boise St and ASU would not have been selected.
Zero2Cool (21-Jan) : So that was 7 vs 8, that means in BCS they never would made it?
Martha Careful (21-Jan) : A great game. Give ND credit for coming back, although I am please with the outcome.
Mucky Tundra (21-Jan) : FG to make it academic
Mucky Tundra (21-Jan) : and there's the dagger
Mucky Tundra (21-Jan) : ooooo 8 point game with 4 minutes to go!
Mucky Tundra (21-Jan) : ooooooooohhhhhh he missed!
Mucky Tundra (21-Jan) : Ooooo that completion makes things VERY interesting
Mucky Tundra (21-Jan) : Game not over yet
beast (21-Jan) : Oh yeah, Georgia starting quarterback season ending elbow injury
beast (21-Jan) : Sadly something happened to Georgia... they should be playing in this game against Ohio State
beast (21-Jan) : I thought Ohio State and Texas were both better than Notre Dame & Penn State
Mucky Tundra (21-Jan) : Notre Lame getting rolled
Martha Careful (21-Jan) : Ohio State just got punched in the gut. Lets see how they respond
Mucky Tundra (21-Jan) : Notre Lame vs the Luckeyes, bleh
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
7h / Green Bay Packers Talk / Martha Careful

7h / Green Bay Packers Talk / Martha Careful

17h / Random Babble / Martha Careful

21-Jan / Green Bay Packers Talk / Mucky Tundra

21-Jan / Green Bay Packers Talk / Mucky Tundra

20-Jan / Green Bay Packers Talk / Martha Careful

20-Jan / Green Bay Packers Talk / bboystyle

20-Jan / Green Bay Packers Talk / Zero2Cool

20-Jan / Green Bay Packers Talk / beast

19-Jan / Random Babble / Martha Careful

18-Jan / Green Bay Packers Talk / Zero2Cool

17-Jan / Green Bay Packers Talk / bboystyle

17-Jan / Green Bay Packers Talk / Zero2Cool

17-Jan / Green Bay Packers Talk / Martha Careful

16-Jan / Green Bay Packers Talk / beast

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