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
Mucky Tundra (45m) : @mattschneidman Matt LaFleur on MarShawn Lloyd: “He’s gonna miss some time.”
Mucky Tundra (22h) : CLIFFORD WITH THE TD WITH UNDER 2 TO GO!!!!!
Zero2Cool (16-Aug) : 90 MINUTES UNTIL FAKE KICKOFF!!
Martha Careful (16-Aug) : I think Ruven is a bot, but regardless should be stricken from the site.
Zero2Cool (14-Aug) : Packers RB Josh Jacobs ranked No. 33 in NFL 'Top 100'
dfosterf (13-Aug) : The LVN Musgrave collision- Andy Herman said Musgrave seemed to be the one most impacted injury-wise
dfosterf (13-Aug) : a lower back injury
dfosterf (13-Aug) : Doubs says he's "fine" after injury scare. Some reported it as z
Mucky Tundra (13-Aug) : With LVN that is; need to see what happens in the next practice
Mucky Tundra (13-Aug) : beast, reading about what happened, it sounded like one of those "two guys collide and are moving slow afterwards" type of deals
beast (12-Aug) : I believe Musgrave has been injured every single season since at least a Sophomore in highschool
packerfanoutwest (12-Aug) : Matt LaFleur: “Highly unlikely” Jordan Love plays more this preseason
dfosterf (12-Aug) : Doubs, Savion Williams, LVN, Musgrave all banged up to one degree or another, missing one here I forget
Zero2Cool (12-Aug) : RB Tyrion Davis-Price is signing with the Green Bay Packers.
Zero2Cool (12-Aug) : zero help, dominated. preseason
beast (12-Aug) : QB Jordan Love has surgery
beast (12-Aug) : Martha said Morgan had a lot of help, I didn't watch the OL so I can't say.
Zero2Cool (10-Aug) : Packers LT Jordan Morgan did not allow a single pressure across 23 pass-blocking snaps vs. Jets last night, per PFF
Mucky Tundra (10-Aug) : With buckeye and the reasonable couple, we're currently sitting at 10
buckeyepackfan (10-Aug) : Just posted to re-up on our FFL.
Zero2Cool (10-Aug) : If healthy after, then thats all I care. Well, no drops would be nice
wpr (10-Aug) : I made it through the 1st Q.
dfosterf (10-Aug) : Just gotta figure out how.
dfosterf (10-Aug) : Could have been a worse start, so there is that.
beast (10-Aug) : Yeah, someone tell the Packers football season has started, seems like they weren't ready for it
Mucky Tundra (10-Aug) : Sooooooo many penalties
Mucky Tundra (10-Aug) : It may only be preseason, but this game is a trip to the dentist
Zero2Cool (10-Aug) : Packers do bad -- FREAK OUT!!!!!!
Zero2Cool (10-Aug) : Packers do good -- eh only preseason
dfosterf (10-Aug) : Well that half was fun
Zero2Cool (10-Aug) : Great, zayne is down
Zero2Cool (9-Aug) : 13 minutes away from kickkkkkkkkkkkkkkkkoffff
Zero2Cool (9-Aug) : Had Celebration of Life for my uncle up north. wicked rain hope it dont come south
Mucky Tundra (9-Aug) : THE GREEN BAY PACKERS ARE PLAYING FOOTBALL TONIGHT!!!!!! THIS IS NOT A DRILL!!!!
Zero2Cool (9-Aug) : Woo-hoo
TheKanataThrilla (9-Aug) : NFL Network is broadcasting the game tonight, but not in Canada. Not sure why as no local television is showing the game.
beast (8-Aug) : But the Return from IR designations had to be applied by the 53 man cutdown.
beast (8-Aug) : It's a new rule, so it's not clear, but my understanding was that they could be IR'd at any time
Mucky Tundra (8-Aug) : *had to be IRed at 53
Mucky Tundra (8-Aug) : beast, I thought the designate return from IR players had to be IR at cutdowns to 53, not before
beast (8-Aug) : It's a brand new rule, either last season or this season, prior, all pre-season IRs were done for the season
beast (8-Aug) : But the Packers would have to use one for their return from IR spots on him, when they cut down to 53.
beast (8-Aug) : I think the NFL recently changed the IR rules, so maybe the season might not be over for OL Glover.
Zero2Cool (8-Aug) : Packers star Howton, first NFLPA prez, dies at 95 😔
dfosterf (8-Aug) : Apparently it is too complicated for several to follow your simple instructions, but I digress
dfosterf (8-Aug) : Zero- Did you see what I posted about Voice of Reason and his wife? She posted over at fleaflicker that they are both "In"
Zero2Cool (7-Aug) : Well, not crazy, it makes sense. Crazy I didn't notice/find it earlier
Zero2Cool (7-Aug) : it's crazy how one stored procedure to get data bogged everything down for speed here
dfosterf (7-Aug) : to herd cats or goldfish without a bowl. They reminded me of the annual assembly of our fantasy league
dfosterf (7-Aug) : out on a field trip, outfitting them with little yellow smocks. Most of the little folk were well behaved, but several were like trying
Please sign in to use Fan Shout
2025 Packers Schedule
Sunday, Sep 7 @ 3:25 PM
LIONS
Thursday, Sep 11 @ 7:15 PM
COMMANDERS
Sunday, Sep 21 @ 12:00 PM
Browns
Sunday, Sep 28 @ 7:20 PM
Cowboys
Sunday, Oct 12 @ 3:25 PM
BENGALS
Sunday, Oct 19 @ 3:25 PM
Cardinals
Sunday, Oct 26 @ 7:20 PM
Steelers
Sunday, Nov 2 @ 12:00 PM
PANTHERS
Monday, Nov 10 @ 7:15 PM
EAGLES
Sunday, Nov 16 @ 12:00 PM
Giants
Sunday, Nov 23 @ 12:00 PM
VIKINGS
Thursday, Nov 27 @ 12:00 PM
Lions
Sunday, Dec 7 @ 12:00 PM
BEARS
Sunday, Dec 14 @ 3:25 PM
Broncos
Friday, Dec 19 @ 11:00 PM
Bears
Friday, Dec 26 @ 11:00 PM
RAVENS
Saturday, Jan 3 @ 11:00 PM
Vikings
Recent Topics
14h / Fantasy Sports Talk / GoPack1984

15h / Green Bay Packers Talk / beast

16h / Green Bay Packers Talk / Mucky Tundra

16-Aug / Feedback, Suggestions and Issues / beast

15-Aug / Around The NFL / Mucky Tundra

13-Aug / Green Bay Packers Talk / dfosterf

12-Aug / Green Bay Packers Talk / Zero2Cool

12-Aug / Green Bay Packers Talk / beast

12-Aug / Green Bay Packers Talk / beast

12-Aug / Green Bay Packers Talk / beast

12-Aug / Random Babble / Zero2Cool

11-Aug / Green Bay Packers Talk / bboystyle

11-Aug / Around The NFL / Martha Careful

11-Aug / Around The NFL / packerfanoutwest

10-Aug / Green Bay Packers Talk / dfosterf

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