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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:29:21+00:00 2026-06-15T22:29:21+00:00

SELECT COUNT(*) as Count, IF(sch.HomeTeamID = 34,true,false) AS Hawaii FROM schedule sch JOIN schools

  • 0
SELECT COUNT(*) as Count, IF(sch.HomeTeamID = 34,true,false) AS Hawaii
FROM schedule sch 
JOIN schools s ON s.ID = 83 
WHERE (sch.HomeTeamID = 83 OR sch.AwayTeamID = 83)
AND sch.SeasonID = 4

I’m trying to use count() to simplify my result but also include a field that represents wether any of the results’ specific column contained a certain value. Is this possible? I’d basically like a row response with all the info I need.

  • 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-15T22:29:23+00:00Added an answer on June 15, 2026 at 10:29 pm

    If you are trying to count how many times the home team was 34, do this:

    SELECT 
        COUNT(*) as Count, 
        sum(sch.HomeTeamID = 34) AS Hawaii_home_count
    ...
    

    Incidentally, the terse summing of a condition works in mysql only, because in mysql true is 1 and false is 0, so sum(condition) counts how many times it was true (other databases requires the use of a case statement)

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

Sidebar

Related Questions

SELECT COUNT(`t`.id) FROM `product` `t` INNER JOIN `category` `c1` ON ( `c1`.id ='15' )
SQL : SELECT COUNT(usr.id) as `total_results` FROM users as usr LEFT JOIN profile as
i develop this code: SELECT COUNT(NewEmployee.EmployeeID), NewEmployee.EmployeeId,EmployeeName FROM NewEmployee INNER JOIN NewTimeAttendance ON NewEmployee.EmployeeID
i have this SELECT COUNT(1) cnt, a.auther_id FROM `posts` a LEFT JOIN users u
SELECT COUNT(*) FROM song AS s JOIN user AS u ON(u.user_id = s.user_id) WHERE
Can I use SELECT COUNT(*) from tableName in a C program? If so, how
SELECT COUNT(*) AS TotalUserVotes FROM tblArticleVotes AS v INNER JOIN tblArticles AS a ON
Query 1: SELECT COUNT (A.EMPNO) AS [PRESENT] FROM ERPDATA.NIITESS.DBO.ZEMP_MASXST_WEB_AL A INNER JOIN PPA_EVENTWISEEMPLOYEEMASTER B
SELECT COUNT(*) FROM BigTable_1 Which way I should to use to get number of
SELECT count(*) FROM contacts_lists JOIN plain_contacts ON contacts_lists.contact_id = plain_contacts.contact_id JOIN contacts ON contacts.id

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.