Try this:
Select user_id
from yourtable
where ancestry in ('England', 'France', 'Germany')
group by user_id
having count(user_id) = 3
The last line means the user’s ancestry has all 3 countries.
More Related Contents:
- How do I UPDATE from a SELECT in SQL Server?
- SQL update from one Table to another based on a ID match
- SQL join: selecting the last records in a one-to-many relationship
- COUNT(*) vs. COUNT(1) vs. COUNT(pk): which is better? [duplicate]
- SQL SELECT WHERE field contains words
- What is the difference between using a cross join and putting a comma between the two tables?
- Return a value if no record is found
- SQL WHERE ID IN (id1, id2, …, idn)
- How can I select from list of values in Oracle
- Are there any way to execute a query inside the string value (like eval) in PostgreSQL?
- Select TOP X (or bottom) percent for numeric values in MySQL
- Fastest way to determine if record exists
- How to kill a running SELECT statement
- How do I select all the columns from a table, plus additional columns like ROWNUM?
- DATEDIFF function in Oracle [duplicate]
- Best way to do nested case statement logic in SQL Server
- How to select multiple rows filled with constants?
- How to select only the first rows for each unique value of a column?
- How to write a SQL DELETE statement with a SELECT statement in the WHERE clause?
- Why postgres returns unordered data in select query, after updation of row?
- MySQL: Select DISTINCT / UNIQUE, but return all columns?
- SQL column reference “id” is ambiguous
- SQL SELECT from multiple tables
- Can select * usage ever be justified?
- How to select records without duplicate on just one field in SQL?
- how does SELECT TOP works when no order by is specified?
- Select distinct from multiple fields using sql
- SQL: Select rows with a column value that occurs at least N times?
- “SELECT *” vs “SELECT ” for performance
- Finding unmatched records with SQL