[TYPO3-english] Show count of users in usergroup

Stephan Schuler stephan.schuler at netlogix.de
Sun Dec 29 17:17:40 CET 2013


Hey there.


I agree that having such a format is pretty bad since it is both, difficult
to handle and unnecessary resource consuming.

But that doesn't require stored procedures, you can still use inline query
options.
Have a look at SUBSTRING_INDEX. It's really ugly, but you can do something
like this:

SELECT uid, SUBSTRING_INDEX(timedgroup, , '|', 1) AS group_uid
FROM fe_users
WHERE FROM_UNIXTIME(SUBSTRING_INDEX(SUBSTRING_INDEX(timedgroup, '|', 2),
'|', 1)) <= NOW()
AND FROM_UNIXTIME(SUBSTRING_INDEX(SUBSTRING_INDEX(timedgroup, '|', 3), '|',
1)) >= NOW()


Regards,
  Stephan Schuler.



2013/12/29 Nemanja Todic <tntprograms at gmail.com>

> he structure is basically this " usergroup id | start date | end date | "
>>>
>> IMO the developer of the ext. that introduced this "timed" feature did a
> bad job by storing data in such format.
>
> Because of such structure, there are two options - to mysql create stored
> procedure that will handle this on DB level or to create userFunc that will:
> 1. Select all users from DB (I hope there are not so many of them in DB,
> because it can hurt performances). We need only uid and and this timed field
> 2. Loop through all of the rows and split "timed field" by |. Then it will
> be easy to see whether this record should be counted or not.
> 3. as the result, userFunc will return total count.
>
> Hope this will help you solve the problem
>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
>


More information about the TYPO3-english mailing list