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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:59:53+00:00 2026-06-18T03:59:53+00:00

I have database like this: +—–+———+————–+ | id | user_id | form_answers | +—–+———+————–+

  • 0

I have database like this:

+-----+---------+--------------+
| id  | user_id | form_answers |
+-----+---------+--------------+
|  1  |    1    | yes          |
|  2  |    1    | M            |
|  3  |    2    | yes          |
|  4  |    2    | M            |
|  5  |    3    | no           |
|  6  |    3    | F            |
|  7  |    4    | no           |
|  8  |    4    | M            |
+-----+---------+--------------+

There was a form that inserted to this database . It had one question and dropdown list (male of female). Is it possible to count how many “yes” answers the male (M) users gave? It doesn’t have to be counted…it can just select of all rows with answer “yes” from male users.

  • 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-18T03:59:54+00:00Added an answer on June 18, 2026 at 3:59 am

    You can join answers tabe with itself. This will return the list of “yes” answers male users gave:

    SELECT a1.*
    FROM answers a1 inner join answers a2
         on a1.user_id=a2.user_id
            and a1.form_answers='yes'
            and a2.form_answers='M'
    

    to count the rows, just substitute the select line with this:

    SELECT COUNT(*)
    

    see fiddle here.

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

Sidebar

Related Questions

I have a database that look like this: [Invoice] -PK:ID -... [InvoiceDetail] -PK:ID -FK:Invoice_ID
I have a table in my database like this: [id] [uniqueidentifier] NOT NULL, [user_id]
I have a database connection that I got like this: db = Mongo::Connection.new.db(app-development) but
I have a mysql database that looks like this: |id | city | created
suppose I have a list that comes from a database like this: List<Item> list
I have got a Database like this: users -id user_cars -user_id -car_id cars -id
I have a database like this: id User_id Question_id Answer 1 john Question_1 b
Lets say I have a database that looks like this: tblA: ID, Name, Sequence,
Hi i have database like this Users Table user_id | username | branch_id(foreignkey)| Approved_id(foreignkey)
i have database table like this +-------+--------------+----------+ | id | ip | date |

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.