Zero2Cool
13 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
13 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
13 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
13 years ago
I dunno, do I?
UserPostedImage
dhpackr
13 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
13 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
13 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
13 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
13 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
13 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
Mucky Tundra (14h) : Adds most of the information this time of year comes from agents.
Mucky Tundra (14h) : @RealAlexBarth Bill Belichick says accurate draft information doesn't leak from teams until about 12 hours before the draft. Adds most of th
Mucky Tundra (14h) : I am very happy that for moment, Jordan Love seems like a normal human being
Zero2Cool (17-Apr) : Belichick * whatever
Zero2Cool (17-Apr) : "There's a lot of depth at Offensive Tackle and Wide Receiver." Bill Bellichick
Zero2Cool (17-Apr) : Thanks! I can't believe it's over haha
Martha Careful (16-Apr) : Congratulations
Zero2Cool (16-Apr) : Boom. Student Loan. $0.00. Only took about 20 years.
Zero2Cool (14-Apr) : Packers DT Kenny Clark: New defensive coordinator Jeff Hafley will 'allow us to be way more disruptive'
Zero2Cool (12-Apr) : Saints have agreed to terms on a contract with former Packers wide receiver Equanimeous St. Brown.
beast (12-Apr) : No, but of it's for legislation, then half of the country will find it evil, not good, whatever it says....
Mucky Tundra (12-Apr) : Draft is still 2 weeks away. UGH
dhazer (11-Apr) : Does anyone know of a good AI generator to create letters of Support for legislation?
Zero2Cool (11-Apr) : Gordon "Red" Batty retires as equipment manager
Zero2Cool (10-Apr) : Sounds like that's pretty certain now.
Zero2Cool (10-Apr) : Packers "at" Eagles in Brazil. Week One
dfosterf (10-Apr) : Va' Fazer As Malas Va' !
Zero2Cool (9-Apr) : Mark Murphy tipping us off?
Zero2Cool (9-Apr) : “We’re either the first- or second-most popular team in Brazil.”
Zero2Cool (9-Apr) : Christian Watson got married. Wife better be careful with those hamstrings!! 😂😂
dfosterf (9-Apr) : Those poor bastards
Zero2Cool (8-Apr) : Falcons have signed former Packers CB Kevin King, who has been out of football since 2021.
dfosterf (8-Apr) : Collectively, we need to spend more time in what we have, when analyzing ostendible needs and historical proclivities
dfosterf (8-Apr) : I say he is better than so many of these draft picks
dfosterf (8-Apr) : Question of the week for me: Has anyone besides me done any deep dive into the potential of Alex McGough, our 3rd string qb?
Zero2Cool (8-Apr) : Or in Tunsil's case, something gets released day of draft or day before lol
Zero2Cool (8-Apr) : Seems every year someone does something pre-draft.
dfosterf (8-Apr) : Falling down drunk. The draft board
dfosterf (8-Apr) : Allright! Potential character guy/f#×k up pickup in D'Vondre Sweat!
Zero2Cool (7-Apr) : Go Badgers!!!
Martha Careful (6-Apr) : Go Boilermakers!!!
Martha Careful (5-Apr) : Diggs has not stepped up in the playoffs and has a high cost
beast (5-Apr) : Probably not going to let Diggs walk away unless he's horrible... but according to reports he also might not be as good as he used to be.
beast (5-Apr) : The 25th pick in the draft has been an offensive player since 2017, 2 TE, 2 WR, 1 RB, 1 OC
Mucky Tundra (5-Apr) : Odd, why give up a 2025 2nd Rounder for him if you're just gonna let him walk?
Zero2Cool (4-Apr) : Texans to let Diggs be free agent in '25
buckeyepackfan (4-Apr) : 49r's aign RB Patrick Taylor.
Martha Careful (4-Apr) : Reversion to the mean would indicate we will keep it
Zero2Cool (4-Apr) : It's also been utilized in a trade in 14 of the past 20 years
Zero2Cool (4-Apr) : The 25th pick in the draft hasn't been made by it's original holder since 2016.
Mucky Tundra (4-Apr) : Gotta imagine that Green Bay vs Houston will be a primetime game this upcoming season
Zero2Cool (3-Apr) : No. Kill QB. No worries. 😁
Mucky Tundra (3-Apr) : Diggs, Collins, Dell and Schultz is gonna be tough to cover
Zero2Cool (3-Apr) : Stefon Diggs' trade will not be processed as a post-June 1 designation, so that is just over $31 million in dead cap this year.
Zero2Cool (3-Apr) : Bills trading WR Stefon Diggs to the Texans in exchange for a 2025 2nd-round pick. (via @rapsheet)
beast (3-Apr) : Using Patterson as RB and RB/WR tweener... so I think they also signed Patterson as a 3rd down RB, not just a kick returner as articles are
beast (3-Apr) : I think PFT missed the real Steelers/Patterson connection, Steelers new OC Arthur Smith has been Patterson's head coach the last 3 years
wpr (2-Apr) : It has Martha. I was stunned when I was in HS to learn Iowa was still playing half court BB in the 70's.
Martha Careful (2-Apr) : Caitlin Clark, Angel Reese...women's sports has come a long way. GREAT TO SEE!!
Martha Careful (31-Mar) : Happy Easter everyone. I hope you all have a great day.
Please sign in to use Fan Shout
2023 Packers Schedule
Sunday, Sep 10 @ 3:25 PM
Bears
Sunday, Sep 17 @ 12:00 PM
Falcons
Sunday, Sep 24 @ 12:00 PM
SAINTS
Thursday, Sep 28 @ 7:15 PM
LIONS
Monday, Oct 9 @ 7:15 PM
Raiders
Sunday, Oct 22 @ 3:25 PM
Broncos
Sunday, Oct 29 @ 12:00 PM
VIKINGS
Sunday, Nov 5 @ 12:00 PM
RAMS
Sunday, Nov 12 @ 12:00 PM
Steelers
Sunday, Nov 19 @ 12:00 PM
CHARGERS
Thursday, Nov 23 @ 11:30 AM
Lions
Sunday, Dec 3 @ 7:20 PM
CHIEFS
Monday, Dec 11 @ 7:15 PM
Giants
Sunday, Dec 17 @ 12:00 PM
BUCCANEERS
Sunday, Dec 24 @ 12:00 PM
Panthers
Sunday, Dec 31 @ 7:20 PM
Vikings
Sunday, Jan 7 @ 3:25 PM
BEARS
Sunday, Jan 14 @ 3:30 PM
Cowboys
Saturday, Jan 20 @ 7:15 PM
49ers
Recent Topics
1h / Green Bay Packers Talk / Zero2Cool

3h / Green Bay Packers Talk / Zero2Cool

12h / Random Babble / Mucky Tundra

14h / Green Bay Packers Talk / Mucky Tundra

20h / Random Babble / Martha Careful

17-Apr / Green Bay Packers Talk / Mucky Tundra

17-Apr / Green Bay Packers Talk / Mucky Tundra

17-Apr / Green Bay Packers Talk / beast

17-Apr / Green Bay Packers Talk / beast

17-Apr / Green Bay Packers Talk / beast

16-Apr / Random Babble / Martha Careful

15-Apr / Green Bay Packers Talk / dfosterf

12-Apr / Random Babble / Nonstopdrivel

12-Apr / Green Bay Packers Talk / Martha Careful

11-Apr / Green Bay Packers Talk / Zero2Cool

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