Welcome, Guest. Please Login or Register.
May 22, 2024, 04:25:00 AM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  General Category  |  Feedback  |  Useful Sql queries for admins « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Useful Sql queries for admins  (Read 1420 times)
Overseer
Sr. Member
****
Posts: 455


Useful Sql queries for admins
« on: March 12, 2003, 10:27:44 AM »
Reply with quote

not sure if this is the best place to post this, or if its been posted before. i guess it depends on your posters etc.. on how relevant these are to you. but i'm sure many people out there will have written some SQL queries (or if they dont know SQL well like me would pick up some things or cuold just understand them enough to use them).

I think it would be good for yse if some simple queries were available as a resource for helping check up on things that the board sw doesnt do itself.

here are ones i've written in the last few days. i'll be making more for my own use as time goes on.

i always prefer to see newest -> older in the outupt (thats the ORDER BY posterTime DESC on the end)


all u have to do to use them is dump them in the 'sql' box in phpmyadmin, change the relevant parts (like your prefix wont be dubcc_ like mine) and hit go





dump all posts by ip

SELECT * FROM dubcc_messages WHERE posterIP LIKE '111.222.333.444' ORDER BY posterTime DESC

(would like to know how to do a partial match)

posts by user aaa and user bbb

SELECT * FROM dubcc_messages WHERE posterName LIKE 'Docky' OR posterName LIKE 'Tech' ORDER BY posterTime DESC

(can check if a user is posting from the same IP between accounts.. kinda useless for AOL users tho :( )



dump all messages sent to...

SELECT * FROM dubcc_instant_messages WHERE toName LIKE 'Overseer' ORDER BY msgtime DESC

can check if user really got sent a message by someone, or if they have read it

dump all messages sent by

SELECT * FROM dubcc_instant_messages WHERE fromName LIKE 'Overseer' ORDER BY msgtime DESC

can check if user really sent a message to someone, or if they have read it


dump all messages sent by or to..


SELECT * FROM dubcc_instant_messages WHERE toName LIKE 'Overseer' OR fromName LIKE 'Overseer'  ORDER BY msgtime DESC

basically a log of messages to and from a user in order... useful for seeing 'who started it'




« Last Edit: March 12, 2003, 10:31:55 AM by Overseer » Logged

I learned that from the G's, a G is an Overseer, the Overseer sees.
More than you do 'cause he gets experienced - Snoop on Daz's OG

Supreme exalted, universal leader, Descendent of the kings and queens, the Overseer
The overlord, cream of the crop, creme de la creme - Gang Starr  Royalty
Spaceman-Spiff
Mod Team
YaBB God
*****
Posts: 3689


My $txt[228]

Re:Useful Sql queries for admins
« Reply #1 on: March 12, 2003, 10:32:57 AM »
Reply with quote

Quote from: Overseer on March 12, 2003, 10:27:44 AM
dump all posts by ip

SELECT * FROM dubcc_messages WHERE posterIP LIKE '111.222.333.444' ORDER BY posterTime DESC

(would like to know how to do a partial match)

SELECT * FROM {$db_prefix}messages WHERE posterIP LIKE '111.222.%' ORDER BY posterTime DESC

% is the wildcard for LIKE statement
for more info: http://www.mysql.com/doc/en/String_comparison_functions.html
Logged

   My mods, ysePak, codes, tutorials
    Support question IMs = bad.
Overseer
Sr. Member
****
Posts: 455


Re:Useful Sql queries for admins
« Reply #2 on: March 12, 2003, 10:33:16 AM »
Reply with quote

cool thanks :)

* Overseer fiddles ;)
Logged

I learned that from the G's, a G is an Overseer, the Overseer sees.
More than you do 'cause he gets experienced - Snoop on Daz's OG

Supreme exalted, universal leader, Descendent of the kings and queens, the Overseer
The overlord, cream of the crop, creme de la creme - Gang Starr  Royalty
Overseer
Sr. Member
****
Posts: 455


Re:Useful Sql queries for admins
« Reply #3 on: March 12, 2003, 10:40:22 AM »
Reply with quote

so far they've all been non-modifying ones.

i'm gonna make a test dbase and learn some other ones - like tying posts from deleted/banned accounts up with new usernames for people i've let back.
« Last Edit: March 12, 2003, 10:40:50 AM by Overseer » Logged

I learned that from the G's, a G is an Overseer, the Overseer sees.
More than you do 'cause he gets experienced - Snoop on Daz's OG

Supreme exalted, universal leader, Descendent of the kings and queens, the Overseer
The overlord, cream of the crop, creme de la creme - Gang Starr  Royalty
Overseer
Sr. Member
****
Posts: 455


Re:Useful Sql queries for admins
« Reply #4 on: March 12, 2003, 10:55:00 AM »
Reply with quote

here's one [unknown] wrote for me when i queried a while back in this post...




it resets all karma on a board (i did this at new year)

UPDATE dubcc_members SET karmaGood = 0, karmaBad = 0;
Logged

I learned that from the G's, a G is an Overseer, the Overseer sees.
More than you do 'cause he gets experienced - Snoop on Daz's OG

Supreme exalted, universal leader, Descendent of the kings and queens, the Overseer
The overlord, cream of the crop, creme de la creme - Gang Starr  Royalty
David
Destroyer Dave
Global Moderator
YaBB God
*****
Posts: 5761


I'm not a llama!

WWW
Re:Useful Sql queries for admins
« Reply #5 on: March 12, 2003, 06:26:26 PM »
Reply with quote

* David nudges this back on topic by splitting it into a new thread
http://www.yabbse.org/community/index.php?board=1;action=display;threadid=20078
« Last Edit: March 12, 2003, 06:30:50 PM by David » Logged

Pages: [1] Reply Ignore Print 
YaBB SE Community  |  General Category  |  Feedback  |  Useful Sql queries for admins « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.033 seconds with 19 queries.