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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:27:02+00:00 2026-06-13T13:27:02+00:00

This one is stumping me, I will just go ahead and explain via SQL.

  • 0

This one is stumping me, I will just go ahead and explain via SQL. Here is the data structure:

Property

PropertyId     Name         
1              Property one
2              Property two

Property Features

PropertyFeatureId     FeatureId     PropertyId
1                     1             1
2                     2             1
3                     1             2

Feature

FeatureId     Name
1             Hot tub
2             Wifi

How would I go about finding all properties that have a hot tub AND wifi? So in the example above I would want propery 1, but not 2.

One way I suppose is inner-joining and filtering by the ones we want, but I want to generalize this so I can find all properties with feature A, B, C and so on.

  • 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-13T13:27:03+00:00Added an answer on June 13, 2026 at 1:27 pm

    The idea here is to count the number of instances of propertyName and that it is equal to the number of values supplied in the WHERE clause condition.

    SELECT  a.Name
    FROM    Property a
            INNER JOIN [Property Features] b
                ON a.PropertyID = b.PropertyId
            INNER JOIN Feature c
                ON b.FeatureID = c.FeatureID
    WHERE   c.Name IN ('Hot tub','Wifi')
    GROUP BY a.Name
    HAVING COUNT(DISTINCT c.Name) = 2
    

    SQLFiddle Demo

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

Sidebar

Related Questions

This one has been stumping me for a while. But I'm no expert. This
I have been using jQuery for some time and this one's stumping me- I
This one is bit tricky , I created jsfiddle here http://jsfiddle.net/WXmcL/10/ to kinda replicate
this one is hard to explain! I am writing a python application to be
This one's tough to explain, so I'll try to show what I'm after using
This one is tough to explain inside the title. What I have going on
This one has been stumping me for a good minute now. I am working
This one will take some explaining. What I've done is create a specific custom
I am trying to iterate over this data structure: $deconstructed->{data}->{workspaces}[0]->{workspace}->{facts}[0]->{code} where fact[0] is increasing.
This one is bit complicated than sinmple range in mysql , my field data

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.