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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:33:44+00:00 2026-05-24T17:33:44+00:00

Hi I need a query like this select count(id) from employee where.. => gives

  • 0

Hi I need a query like this


    select count(id) from employee where.. => gives count1=10

    select count(id) from emplyer where..  => gives count2=5

    select count(id) from users where..    => gives count3=20

I can add these result like this


    count = count1+count2+count3;

But I want to know whether there is any option get count using a single query instead of add these result separatly. Also I want to know which one is the best way in case of application perfomance.

  • 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-05-24T17:33:45+00:00Added an answer on May 24, 2026 at 5:33 pm

    You can do

    SELECT ((select count(id) from employee where..) + (select count(id) from emplyer where..) + (select count(id) from users where..))
    

    There will hardly be a performance difference – adding three integers is neither a challenge for the MySql nor for the php engine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to do a query like this: SELECT wposts.ID FROM posts wposts WHERE
I need to make a query like this: SELECT PNPDeviceID FROM Win32_NetworkAdapter WHERE AdapterTypeId
I have a query like this: SELECT type.id, type.name, COUNT(*) AS tot FROM page
Is there a better way of doing a query like this: SELECT COUNT(*) FROM
I need to query a table like this: select phrase_id from direct_words where knowledge_id
I have a query which works, goes like this: Select count(InsuranceOrderLine.AntallPotensiale) as potensiale, COUNT(InsuranceOrderLine.AntallSolgt)
I need to write a query like this, any help please? select id, parent,
I have a query which is something like this SELECT t.category, tc.product, tc.sub-product, count(*)
I need to have MySQL query like this one: UPDATE table_name SET 1 =
I'm playing with GAE, and need to make a query with something like this:

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.