vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=320567

SQL Query for number of posts per user group
by kgroneman
19 Oct 2015 16:20

Hi,

I'm trying to get the number of posts for users in a specific user group in a specific timeframe and am using this query:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

However, I get the following error regarding "dateline"

An error occurred while attempting to execute your query. The following information was returned.
error number: 1054
error desc: Unknown column 'dateline' in 'where clause'

Can anyone help me with this? I have four 4.2.2 PL4 forum sets and this happens on all four

If I take out the dateline sections, it works, but it gives me stats for all time, not just the date range I'm looking for. What am I doing wrong?

Dave 19 Oct 2015 16:28

The user table does not have a dateline column, that's why it doesn't work.
You can use: joindate, lastvisit, lastactivity, lastpost.

By the way it's easier to write WHERE usergroupid IN (10, 62) for the first WHERE statement.

kh99 19 Oct 2015 17:23

I think you want something like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


kgroneman 19 Oct 2015 20:48

Quote:

Originally Posted by Dave (Post 2557287)
The user table does not have a dateline column, that's why it doesn't work.
You can use: joindate, lastvisit, lastactivity, lastpost.

By the way it's easier to write WHERE usergroupid IN (10, 62) for the first WHERE statement.

Thanks Dave. The options you list won't give me statistics for the users in that group for JUST that time period which is what I'm looking for. Thanks for the response and thanks for the shortcut for usergroup.

--------------- Added 19 Oct 2015 at 20:50 ---------------

Quote:

Originally Posted by kh99 (Post 2557291)
I think you want something like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Thanks for the help. That only gives me a total number for those usergroups which isn't exactly what I'm looking for. I'm trying to get a list of users in those specific user groups along with the number of posts per each user for that time period. I'm not very good at SQL queries (which must be obvious). I appreciate the response.

--------------- Added 19 Oct 2015 at 21:11 ---------------

I've been playing around with it a bit and I've almost got the following to work:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If I take out the "AND (usergroup='10')" line it works but it's for ever user. How do I get it to work for just a single usergroup?

Dave 19 Oct 2015 21:14

Try:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


kgroneman 19 Oct 2015 21:15

I found it! Thanks to your help and guidance:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

It does just what I want. Thanks so much for taking the time to respond.

--------------- Added 19 Oct 2015 at 21:24 ---------------

Ok, one last (I hope) question: How do I get email addresses to also show along with the user ID in the resultant list?


All times are GMT. The time now is 06:03.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.