Question: Finding multiple ranges within 1 column

tpat

New member
Local time
Today, 06:25
Joined
Dec 13, 2012
Messages
2
First of all, let me say that this is my first time posting a question, but I have used this site many times to help me with my database issues. But this issue i've got i was unable to find/figure out, so i thought I'd venture out of the darkness to see if you all might be able to shine some light on the situation.

I'm trying to do some analytics on some data and am encountering an issue when i try to figure out the range of values a given customer might have. To simplify the situation:

Suppose I have a table with the following fields:
Customer - call them A, B, C etc - I have about 2000 customers
transaction number - Each customer provides us data with 2 distinct transaction ranges. each customers range is different (IE: customer A can have ranges 5001001 to 5002001 and 1001001 to 1001050 and customer B can have a range of 3001 to 3050 and 40002 to 50001). Each customer only has 2 ranges (but can also have only 1), and each range are orders of magnitude different (as in my example).

I would like to define each customers ranges such that I can figure out the MIN and MAX of each range for each customer.

My challenges have been the huge amount of data (about 2,000,000 records) and that no where else in the data is there any secondary information that i could use to differentiate the two ranges into two distinct transaction types.

This might be to overly specific, but does anyone have any thoughts on how i might be able to identify the two ranges?

Thanks in advance.
 
Order of magnitude is customarily a factor of 10, which does not apply in your first example -is the example wrong or is the order of magnitude thing wrong? If the example is wrong, then you just need to find the min/max value for each order of magtnitude for each customer, say 3-digit, 4-digit-5-digit etc. If the numbers of the tow ranegs are the same order of magnitude, then you probably also need to make intervals within each order of magnitude
 
Thanks for your help - you actually made me realize that i can categorize each range by its first character in the number, and differentiate them that way. I figured id use LEN() to make sure i don't get errors when the ranges are
range 1: 3001-3050
range 2: 310001- 310051

Thanks!
 

Users who are viewing this thread

Back
Top Bottom