Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jun 2006
Posts: 693
Addict
Addict
Joined: Jun 2006
Posts: 693
We want to run a report to see the latest post date for each moderator, to track down moderators who are AWOL. I wrote this query -

Select u.user_display_name, ud.user_last_post_time, ud.user_last_visit_time

from ubbt7_users u, ubbt7_user_data ud

where u.user_id = ud.user_id and
u.user_id in (select m.user_id from ubbt7_moderators m)

but the post time and visit times are just integer strings which will be a royal pain to deal with smile Is there any easy way to format these in SQL to show something of value? I'm curious why these weren't stored in the database as date values? Does this mean we can't do any SQL report to give us the info we need? Will I have to create some sort of a PHP page report?


Lisa Shea, owner, BellaOnline.com
BellaOnline Website
BellaOnline Forums - UBB since Apr 2002 - 58,000 members / 850,000 posts
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
use FROM_UNIXTIME

example of what you might try below

SQL Query
SELECT 
 t1.USER_ID AS ID, t1.USER_DISPLAY_NAME AS Member, 
 FROM_UNIXTIME( t3.USER_LAST_VISIT_TIME,'%M %e, %Y - %h:%i %p') AS LastOn,
 FROM_UNIXTIME( t3.USER_LAST_POST_TIME,'%M %e, %Y - %h:%i %p') AS LastPosted
FROM ubbt_USERS AS t1 
LEFT JOIN ubbt_USER_GROUPS AS t2 ON t1.USER_ID = t2.USER_ID 
LEFT JOIN ubbt_USER_DATA AS t3 ON t1.USER_ID = t3.USER_ID 
WHERE t2.GROUP_ID IN (2,3)
ORDER BY t3.USER_LAST_POST_TIME

*note upper case shouldn't matter in windows*
*note groups 2,3 are mods and global mods*
*note you can use this as a general 'activity' indicator for ANY group(s)*

Joined: Jun 2006
Posts: 693
Addict
Addict
Joined: Jun 2006
Posts: 693
Look at that! You're a genius!! He he he.

Thank you so much!


Lisa Shea, owner, BellaOnline.com
BellaOnline Website
BellaOnline Forums - UBB since Apr 2002 - 58,000 members / 850,000 posts
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
you're welcome and thanks..

i keep a toolbox of 'handy queries' around for things like you just wanted.

Linky Poo to some others i've saved.

i really need to update that thread! frown

<-- lazy


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
0 members (), 686 guests, and 131 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)