count word

Codes here !

Moderators: egami, macek, gesf

Post Reply
User avatar
php-forum Fan User
php-forum Fan User
Posts: 979
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Thu May 17, 2012 4:52 am

To Count the number of records found you would just select a second variable "COUNT(*) from the result set.

Code: Select all

    SELECT COUNT(*) AS count, SUM( LENGTH(message) - LENGTH(REPLACE(message, ' ', ''))+1) AS sum
    FROM mdl_forum_posts WHERE userid = 29254
    AND created>=1329692400 and created<=1339279200
    Group by message
    HAVING sum>=30

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 3 guests