Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
MS Access 2003 Query Question
Old 07-20-2010, 05:21 AM MS Access 2003 Query Question
Junior Talker

Posts: 1
Trades: 0
I am trying to design a query to identify instances when, for every instance of the data in Field1, the data in Field2 field varies. Both fields can contain duplicated data. For example with the following data:

Data_Ref......Field1.......Field 2
12345.............1.............1
45725.............1.............2
15252.............1.............2
25128.............2.............1
25684.............2.............2
10528.............2.............1
...
45635.............31.............2
56745.............31.............2
67856.............31.............2

25125.............35.............1
34562.............35.............1
56453.............35.............2
56746.............35.............3

Data_Ref field is a primary field - no duplicates.

I would like the query to return the records containing 1,2 and 35 in "Field1" but not 31 (because for all values of 31 in "Field1", the values in "Field2" are identical).

I require a report of all the records where "Field1" has varying "Field2"'s and ideally the report would give all the records where this occurs - i.e the report would produce 10 records in my example (total 13 records less the 3 records with 31 in "Field1")

In other words, for every numeric value in the field "Field1", I would like to test to see that all the values in the field "Field2" are the same. If they are then I don't want the query to return any of those records but if they are not then I want the query to return all of those records. For example if there are say 8 records with the value 22 in Field1 and all of them have a value of 1 in Field2 then I don't want the query to return any of these 8 records. On the other hand if any one (or more) of these 8 records had a different value in Field2 then I would like the query to return all 8 records.

I would be very grateful for any pointers as to how I could do this as I have thousands of records in a table to run this on.

Thank you in advance
MC1-1 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-20-2010, 07:40 AM Re: MS Access 2003 Query Question
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Not going to happen using a query!

It would need a stored procedure/function to compare the current row with the previous row and "decide" whether to include the row or not
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to MS Access 2003 Query Question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10195 seconds with 12 queries