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 (17h) : Based on Gutes comments, now I don't feel as silly having 13 picks in my mock the other day
Zero2Cool (18h) : Zach Wilson to Broncos.
Zero2Cool (21h) : Gutekunst says he'd love to have 13 or 14 picks. He's trading back huh lol
beast (23h) : Someday we'll have a draft betting scandal
beast (21-Apr) : Sometimes looking extremely amazing, sometimes looking extremely lost
beast (21-Apr) : I haven't looked into the QBs, but some have suggested Maye has some of the most extremely inconsistent tape they've seen
beast (21-Apr) : Well it also sounds like Patriots are listening to trade offers, not that seriously considering any, but listening means they aren't locked
Zero2Cool (21-Apr) : Maye needs to be AFC
Mucky Tundra (21-Apr) : Not liking the idea of the Vikings getting Maye
Zero2Cool (21-Apr) : Vikings HC joked that he may or may not have sent flowers to Bob Kraft. That's where rumor came from.
beast (21-Apr) : Can't tell if this is real or BS, but some rumors about a possible Patriots/Vikings trade for #3 overall
dfosterf (21-Apr) : One playbook to my knowledge. I was shooting for facetious.
beast (20-Apr) : I'm not sure they have different playbooks for different OL positions, and Dillard run blocking is supposedly worse than his pass blocking..
dfosterf (19-Apr) : The only problem with that is he isn't a guard either.
dfosterf (19-Apr) : Put him at right guard. That is where he will be coached. That is where he will compete. He is not even allowed to look at the LT playbook.
dfosterf (18-Apr) : Kidding aside, I hope the best for him.
dfosterf (18-Apr) : Went to a Titans board. One comment there. Not very long. I quote: "LOL" They don't sound overly upset about our aquisition.
beast (18-Apr) : OT Dillard has been absolutely horrible... like OG Newman levels
dfosterf (18-Apr) : Suit him up and have him stand in front of the big board as a draft day cautionary tale.
Zero2Cool (18-Apr) : Packers sign T Andre Dillard.
Mucky Tundra (18-Apr) : Adds most of the information this time of year comes from agents.
Mucky Tundra (18-Apr) : @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 (18-Apr) : 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!!!
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
14h / Green Bay Packers Talk / Mucky Tundra

22-Apr / Green Bay Packers Talk / Mucky Tundra

21-Apr / Fantasy Sports Talk / dfosterf

21-Apr / Green Bay Packers Talk / dfosterf

19-Apr / Green Bay Packers Talk / dfosterf

19-Apr / Random Babble / Zero2Cool

18-Apr / Green Bay Packers Talk / Zero2Cool

18-Apr / Random Babble / Mucky Tundra

18-Apr / Green Bay Packers Talk / Mucky Tundra

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

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