hi,
i'm building a query to find narrow ranges of zip codes within broader
ranges in a table (for tax purposes). for example:
LOW_ZIP HI_ZIP
23400 23499
need to find
23401 23402
23403 23440
23441 23... you get the picture. :)
so, each row has a low value and a hi value, then i need to run a
subquery to take those values and find narrower ranges. any ideas? 3 10554
"dbarchitech" <no*******@mac.com> wrote in message
news:9d**************************@posting.google.c om...
| hi,
|
| i'm building a query to find narrow ranges of zip codes within broader
| ranges in a table (for tax purposes). for example:
|
| LOW_ZIP HI_ZIP
| 23400 23499
|
| need to find
| 23401 23402
| 23403 23440
| 23441 23... you get the picture. :)
|
| so, each row has a low value and a hi value, then i need to run a
| subquery to take those values and find narrower ranges. any ideas?
yeah, but you got to show us yours first ;-)
;-{ mcs
"Mark C. Stock" <mcstockX@Xenquery .com> wrote in message news:<eP********************@comcast.com>... "dbarchitech" <no*******@mac.com> wrote in message news:9d**************************@posting.google.c om... | hi, | | i'm building a query to find narrow ranges of zip codes within broader | ranges in a table (for tax purposes). for example: | | LOW_ZIP HI_ZIP | 23400 23499 | | need to find | 23401 23402 | 23403 23440 | 23441 23... you get the picture. :) | | so, each row has a low value and a hi value, then i need to run a | subquery to take those values and find narrower ranges. any ideas?
yeah, but you got to show us yours first ;-)
;-{ mcs
yeah, well mine doesn't work!!! :-$
select sales_tax_id,
from_postal_code,
to_postal_code
from ar_sales_tax a,
(select from_postal_code as fpc,
to_postal_code as tpc
from ar_sales_tax
where rowid = rowid) b
where from_postal_code between b.fpc and b.tpc
and to_postal_code between b.fpc and b.tpc
and end_date is null
i need to somehow scan the entire table row by row looking for records
that fit within the ranges... i'm thinking i may need to do this using
a cursor.
-cam
"dbarchitech" <no*******@mac.com> wrote in message
news:9d**************************@posting.google.c om...
| "Mark C. Stock" <mcstockX@Xenquery .com> wrote in message
news:<eP********************@comcast.com>...
| > "dbarchitech" <no*******@mac.com> wrote in message
| > news:9d**************************@posting.google.c om...
| > | hi,
| > |
| > | i'm building a query to find narrow ranges of zip codes within broader
| > | ranges in a table (for tax purposes). for example:
| > |
| > | LOW_ZIP HI_ZIP
| > | 23400 23499
| > |
| > | need to find
| > | 23401 23402
| > | 23403 23440
| > | 23441 23... you get the picture. :)
| > |
| > | so, each row has a low value and a hi value, then i need to run a
| > | subquery to take those values and find narrower ranges. any ideas?
| >
| > yeah, but you got to show us yours first ;-)
| >
| > ;-{ mcs
|
| yeah, well mine doesn't work!!! :-$
|
| select sales_tax_id,
| from_postal_code,
| to_postal_code
| from ar_sales_tax a,
| (select from_postal_code as fpc,
| to_postal_code as tpc
| from ar_sales_tax
| where rowid = rowid) b
| where from_postal_code between b.fpc and b.tpc
| and to_postal_code between b.fpc and b.tpc
| and end_date is null
|
| i need to somehow scan the entire table row by row looking for records
| that fit within the ranges... i'm thinking i may need to do this using
| a cursor.
|
| -cam
well, know we know that you tried something!
you won't need a cursor, and you won't need to be one either ;-)
i'll take a stab at it, but it would be nice if you could elaborate on
'doesn't work'
regarding your query
select ...
from ar_sales_tax a
,(
select ...
from ar_sales_tax
where rowid = rowid
) b
the rowid=rowid is always true, don't you think?
so there is no added value in that statement
and there is no added value in the in-line view (the in-line subquery you've
aliased as 'b'
so, if that's simplified to
select ...
from ar_sales_tax a
, ar_sales_tax b
where a.from_postal_code between b.from_postal_code and
b.to_postal_code
and a.to_postal_code between b.from_postal_oce and
b.to_postal_code
and a.end_date is null
all that's going to do for you is give you rows in the 'A' pass at your
table where rows are found in the 'B' pass with a range of codes that
overlap each of the codes from the 'A' pass -- but it doesn't tell you
anything about the relationship between the two passes, and doesn't limit
the results to any specific pair of codes
assuming you're looking for ranges narrower than your 23400/23499 sample,
how about narrowing one of the passes by that pair of values? or returning
the range from the A pass and the range from the B pass in your select
clause, so that you've got something to work with?
;-{ mcs This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Stephen Boulet |
last post by:
I have a long list of floats (1613808 elements long). It takes quite a
while to load this into a 7 dimensional Numeric array.
Is there any obvious way to speed this up?
def...
|
by: beliavsky |
last post by:
I have been looking at the speed of Python with the Numeric module by simulating
some random numbers and computing some statistics. Here is the code. Line
(1) is replaced as shown
in the table.
...
|
by: Matt Feinstein |
last post by:
Hi all--
I'm new to Python, and was somewhat taken aback to discover that the
core language lacks some basic numerical types (e.g., single-precision
float, short integers). I realize that there...
|
by: Luigi Ida' via SQLMonster.com |
last post by:
Hi,
I have a php application connected through odbc to a sqlserver database.
When I try to execute select queries on a smalldatetime table field I
receive this message:
Warning: Numeric value...
|
by: Dr John Stockton |
last post by:
It has appeared that ancient sources give a method for Numeric Date
Validation that involves numerous tests to determine month length;
versions are often posted by incomers here. That sort of code...
|
by: MrNobody |
last post by:
I just noticed that a numeric up/down will let you manually type in any
number even if it is beyond the min/max range you specified.
The control will not actually return this value if it is...
|
by: Sheldon |
last post by:
Hi,
I have the following loop that I think can be written to run faster in
Numeric. I am currently using Numeric.
range_va =
main.xsize= 600
main.ysize= 600
#msgva is an (600x600) Numeric...
|
by: tron_23 |
last post by:
hi,
we use Toplink (TopLink - 4.6.0 (Build 417) with a DB2 Database 7.2. i
know really old versions, but we could change to e newer one ;-)
Sometimes we got some problems with update or insert...
|
by: dbarchitech |
last post by:
hi,
i'm building a query to find narrow ranges of zip codes within broader
ranges in a table (for tax purposes). for example:
LOW_ZIP HI_ZIP
23400 23499
need to find
23401 ...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |