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 8437693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:30:17+00:00 2026-06-10T07:30:17+00:00

here is the query, I have inner joined 3 tables, Now i am looking

  • 0

here is the query, I have inner joined 3 tables, Now i am looking to count all rows in the result i.e. 78 by executing query on php my admin, I don’t want result of table, i jst want 1 row in wchich only thing written is 78, same as we do in

SELECT count (*) FROM test_table

Below is the query of 3 inner joined tables

        SELECT 
mybb_users.uid,
mybb_users.username,
mybb_users.avatar,
mybb_posts.fid,
mybb_posts.uid,
mybb_posts.dateline,
mybb_posts.tid,
mybb_posts.subject,
mybb_forums.parentlist,
mybb_forums.fid
FROM mybb_forums
    INNER JOIN mybb_posts ON mybb_forums.fid = mybb_posts.fid
    INNER JOIN mybb_users ON mybb_posts.uid = mybb_users.uid
    WHERE mybb_forums.parentlist LIKE '%58%'
    GROUP BY mybb_posts.tid
    ORDER BY mybb_posts.dateline DESC

now how to count total number of rows in it ?

EDITED

 SELECT count( mybb_users.uid ) AS totalOfRows
FROM (

SELECT mybb_users.uid, mybb_users.username, mybb_users.avatar, mybb_posts.fid, mybb_posts.uid AS uidPost, mybb_posts.dateline, mybb_posts.tid, mybb_posts.subject, mybb_forums.parentlist, mybb_forums.fid AS fidForum
FROM mybb_forums
INNER JOIN mybb_posts ON mybb_forums.fid = mybb_posts.fid
INNER JOIN mybb_users ON mybb_posts.uid = mybb_users.uid
WHERE mybb_forums.parentlist LIKE '%58%'
GROUP BY mybb_posts.tid
)T

Error ::#1054 – Unknown column ‘mybb_users.uid’ in ‘field list’

  • 1 1 Answer
  • 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

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:30:19+00:00Added an answer on June 10, 2026 at 7:30 am

    well, if you don’t want the result, why are you showing those fields ? A select return one table, so apply count to it:

    SELECT 
    count(*)
    FROM mybb_forums
        INNER JOIN mybb_posts ON mybb_forums.fid = mybb_posts.fid
        INNER JOIN mybb_users ON mybb_posts.uid = mybb_users.uid
        WHERE mybb_forums.parentlist LIKE '%58%'
        GROUP BY mybb_posts.tid
    

    Also, you’re groupying by posts, so, don’t need to order

    Edit:
    I think the query I’ve posted should work, anyway, if it’s not, this definitely should work:

    SELECT sum(Total) AS totalOfRows 
    FROM ( 
    
    SELECT 1 as Total 
    FROM mybb_forums 
    INNER JOIN mybb_posts ON mybb_forums.fid = mybb_posts.fid 
    INNER JOIN mybb_users ON mybb_posts.uid = mybb_users.uid 
    WHERE mybb_forums.parentlist LIKE '%58%' 
    GROUP BY mybb_posts.tid 
    )T
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the query which will get me all the contacts have HD quality
I have an sql query with inner joins of four tables that takes more
I have a complex query that joins different tables to get the count. There
What causes a query of joined tables to display duplicate data. I have tried
I have a query to return random distinct rows from an Access database. Here
I have the following code to perform a dynamic query of JOINED tables but
I have a query here regarding the value given to the update attribute of
I'm stuck with another coordinates related query here. I have a number of CSV
Here is my access query that I have. Every value that I return is
I have this query which works correctly in MySQL. More background on it here

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.