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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:57:34+00:00 2026-06-15T03:57:34+00:00

I have two tables one with observers and another with animals. Im trying to

  • 0

I have two tables one with observers and another with animals.

Im trying to get the name of observers who have either seen more than 5 animals OR seen a bear.

I am able to get observers with more than 4 animals but not sure how to do the OR statement.

This is my code:

SELECT o.last_name, o.first_name, a.observer_id, count (a.observer_id) as Animals_Seen
from animals as a inner join observer as o 
on a.observer_id = o.observer_id
group by a.observer_id, o.last_name, o.first_name
having count (a.observer_id) > 4;

This is what I get:

enter image description here

  • 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-15T03:57:36+00:00Added an answer on June 15, 2026 at 3:57 am

    Set a boolean value to 1 whenever a bear is spotted… then check whether the observer’s bear count > 0:

    select
        o.last_name, o.first_name, a.observer_id, count(a.observer_id) as Animals_Seen,
        sum(iif(a.animal = "bear", 1, 0)) as BearCount
    from 
        animals as a inner join observer as o 
    on 
        a.observer_id = o.observer_id
    group by 
        a.observer_id, o.last_name, o.first_name
    having
        count(a.observer_id) > 4 or sum(iif(a.animal = "bear", 1, 0)) > 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables one with ID and NAME table 1 ID | NAME
I have two tables: one called Projects, and another called Documents (projects has many
I have two tables: one contains employees information and another is transactions (sales) information
I have two tables one to many: Table1 ID Name 1 Abe 2 David
i have two tables one for users which keeps the user info another is
I have two tables one named Person , which contains columns ID and Name
I have two tables - one containing Address and another containing Photographs. The only
Ok I have Two Tables One is business id name telephone primary_category secondary_category tertiary_category
I have two tables - one called customer_records and another called customer_actions . customer_records
I have two tables one tblEmployee and another tblCity . The two tables are

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.