Link to home
Start Free TrialLog in
Avatar of leecett
leecettFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access query

I have a table which contains the following fields: Day, Code and hours.
I need a query which will return all records where day and code are equal, but hours is different.
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

You can do something like this to do what you are looking for..

select tb1.* from 
table1 tb1
where tb1.day=tb1.code and tb1.day<>tb1.hours;

Open in new window


Saurabh...
Avatar of leecett

ASKER

Thanks for the prompt response, I need to clarify my question with an example:
Day,Code,Hours
1,5,8
1,4,6
1,5,7
1,4,6

Query returns these records:
1,5,8
1,5,7

As these two records have identical values for both Day and Code, but different value for hours.
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of leecett

ASKER

Thanks Rey