Avatar of leecett
leecett
Flag 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.
Microsoft AccessSQL

Avatar of undefined
Last Comment
leecett

8/22/2022 - Mon
Saurabh Singh Teotia

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...
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
Rey Obrero (Capricorn1)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
leecett

ASKER
Thanks Rey
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck