TheCandyman
Technical User
I'm trying to write a SQL statement for Access that will look at one column and only show those that have both values. For example, in looking for users that have both 'aaaa' AND 'bbbb' would be User1.
Currently I'm getting all those that have either 'aaaa' or 'bbbb' but not both, and simply switching the OR to a AND results in no results.
I asked in the SQL form but only got commands that run on SQL Server and not MS Access. Any ideas? I'm thinking a nested SQL query but I'm not sure where to start.
Code:
Column1 Column2
User1 aaaa
User2 bbbb
User1 bbbb
User2 cccc
User3 aaaa
Currently I'm getting all those that have either 'aaaa' or 'bbbb' but not both, and simply switching the OR to a AND results in no results.
Code:
SELECT DISTINCT Column1
FROM table
WHERE (Column2='aaaa' OR Column2='bbbb');
I asked in the SQL form but only got commands that run on SQL Server and not MS Access. Any ideas? I'm thinking a nested SQL query but I'm not sure where to start.