Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7491767

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:08:20+00:00 2026-05-29T16:08:20+00:00

I have the following tables in the database. users —————– | id | username

  • 0

I have the following tables in the database.

users
-----------------
| id | username |
-----------------
|  1 | goje     |
|  2 | john     |
|  3 | henry    |
-----------------

comments
-------------------------------------------------
| id | uid |          comment                   |
-------------------------------------------------
|  1 |  1  | One who works hard is the one who  |
|    |     | succeeds                           |
|  2 |  1  | This one was the best.             |
|  3 |  2  | You are one of my best friends.    |
|  4 |  3  | He was the one who bought this one.|
-------------------------------------------------

Now, lets suppose the given word is “one”. I would like to have a MySQL query that can let me know the number of occurrences of this word for each user in the users table.
I this case the result should be

--------------------
| username | count |
--------------------
| goje     | 3     |   -> 2 in first comment and 1 in second
| henry    | 2     |   -> 2 in henry's only comment
| john     | 1     | 
--------------------

Kindly let me know how can I achieve this using SQL. Thanks!!

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Related Questions

I have the following tables in the database. users ----------------- | id | username
I have the following database tables: Table1: User UserId Username Table2: Role RoleId Rolename
I have a Database with the following two tables, USERS, POSTS I am looking
I have the following tables in a MySQL 5.x database: Users: id county_id state_id
I have the following tables in my database that have a many-to-many relationship, which
I have the following tables in a database (i'll only list the important attributes):
I have the following tables, with these keys in my database: bookings session_id sessions
I have two database tables with the following structure: actions: action_id int(11) primary key
I have the following tables in my database: Announcements: - AnnouncementID (PK) - Title
Lets say I have the following 2 tables in a database: [Movies] (Scheme: Automatic)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.