PC Review


Reply
Thread Tools Rate Thread

Killer Query of max and min ranges

 
 
aldo jr
Guest
Posts: n/a
 
      9th Jul 2008
Sample Data Set below.

Table 1:

#, Street Name, Low, High, Edge, Route, Zip,
1, El Camino Real/Hwy 82, 1, 17, Odd, 17C, 94010,
2, El Camino Real/Hwy 82, 1, 1789, Both, 15A, 94030,
3, El Camino Real/Hwy 82, 2, 60, Even, 17C, 94401,
4, El Camino Real/Hwy 82, 19, 298, Both, 15D, 94010,
5, El Camino Real/Hwy 82, 19, 1333, Both, 15C, 94010,
6, El Camino Real/Hwy 82, 100, 1799, Both, 13C, 94066,
7, El Camino Real/Hwy 82, 100, 1099, Both, 11B, 94080,
8, El Camino Real/Hwy 82, 500, 1399, Both, 13B, 94066,
9, El Camino Real/Hwy 82, 1000, 7899, Both, 10C, 94014,
10, El Camino Real/Hwy 82, 1100, 1924, Both, 11A, 94080,
11, El Camino Real/Hwy 82, 1335, 1899, Both, 15B, 94010,

Hi hopefully someone can please help. I am trying to build an access
query that returns to me streets (records) that have overlapping
ranges. For instance; I need to see all of el camino street records
where the ranges over lap (one records high is greater than another
records low) and where the zip code is the same, the street name is
the same, and the route is different.

So from the above example, I would need to see records 4 and 5, and
records 6 and 8.

Thank you
 
Reply With Quote
 
 
 
 
roger
Guest
Posts: n/a
 
      10th Jul 2008
Add the table to a query twice
do not link them!

If your table is called "Untitled" then the 2nd one comes in as "Untitled_1"

Drag all the fields of the 1st table into the QBE grid
the criteria for Street Name is:
=[Untitled_1].[Street Name]
(same for zip)

route is
<>[Untitled_1].[Route]


the criteria for High is:
>=[Untitled_1].[Low] And <= [Untitled_1].[High]


but you may have to work on your logic cuz:
"one records high is greater than another records low) and where the zip
code is the same, the street name is the same, and the route is different."

I think would return every record on that list. at least 3 and 7 anyway

hth

Its just a complex version of "finding duplicate records" which you'll find
in help


"aldo jr" wrote:

> Sample Data Set below.
>
> Table 1:
>
> #, Street Name, Low, High, Edge, Route, Zip,
> 1, El Camino Real/Hwy 82, 1, 17, Odd, 17C, 94010,
> 2, El Camino Real/Hwy 82, 1, 1789, Both, 15A, 94030,
> 3, El Camino Real/Hwy 82, 2, 60, Even, 17C, 94401,
> 4, El Camino Real/Hwy 82, 19, 298, Both, 15D, 94010,
> 5, El Camino Real/Hwy 82, 19, 1333, Both, 15C, 94010,
> 6, El Camino Real/Hwy 82, 100, 1799, Both, 13C, 94066,
> 7, El Camino Real/Hwy 82, 100, 1099, Both, 11B, 94080,
> 8, El Camino Real/Hwy 82, 500, 1399, Both, 13B, 94066,
> 9, El Camino Real/Hwy 82, 1000, 7899, Both, 10C, 94014,
> 10, El Camino Real/Hwy 82, 1100, 1924, Both, 11A, 94080,
> 11, El Camino Real/Hwy 82, 1335, 1899, Both, 15B, 94010,
>
> Hi hopefully someone can please help. I am trying to build an access
> query that returns to me streets (records) that have overlapping
> ranges. For instance; I need to see all of el camino street records
> where the ranges over lap (one records high is greater than another
> records low) and where the zip code is the same, the street name is
> the same, and the route is different.
>
> So from the above example, I would need to see records 4 and 5, and
> records 6 and 8.
>
> Thank you
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
doing bin ranges in a query? pietlinden@hotmail.com Microsoft Access Queries 3 14th Nov 2007 08:32 PM
A Killer Email Message - How to Write Killer Email Promos that Get Results RED Processors 0 28th Sep 2007 04:29 PM
Query help grouping age ranges =?Utf-8?B?dGxrODAw?= Microsoft Access Queries 2 28th Feb 2005 11:21 PM
imposing a ranges on a query =?Utf-8?B?UGhpbA==?= Microsoft Access Queries 1 8th Feb 2005 06:57 PM
Ranges in Criteria of a Query =?Utf-8?B?RGF3bg==?= Microsoft Access Queries 9 24th Nov 2004 05:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:21 PM.