sirr,
Yooo da 'mannn
tx a bunch
>Hi Mark,
>
>How about something like this:
>
>create cursor testrange (pincode I)
>for i = 1 to 1000
> if rand() < 0.25
> insert into testrange values (i)
> endif
>endfor
>
>* do the select
>
>lnRangeSize = 50
>
>select (padl(tran(int(pincode/lnRangeSize) * lnRangeSize + 1), 5, '0') + '-' + ;
> padl(tran((int(pincode/lnRangeSize) + 1) * lnRangeSize), 5, '0')) as RangeName, ;
> count(*) as Hits ;
> from testrange ;
> group by 1
You obviously don't need to set up the test data - I just did that to make sure the SELECT worked.
>
>You can also set the range size.
>
>You could also ORDER by the number of hits etc if that was appropriate.
>
>Cheers,
>
>Andrew
>
>>Hello guys,
>>
>>this is my question
>>
>>I have this table of about 1mill records and
>>about 3 fields,
>>an
>>companyname
>>compid
>>pincode -- It is a unique sequential field
>>
>>what I need to do , if possible through SQL is to
>>select and count by rage of pincodes, say
>>the results of the query will be
>>
>> 1 - 500 100
>>501 - 1000 100
>>1001 - 1500 100
>>etc..
>>
>>Is this posibble using just SQL statements or do It can not be done
>>
>>
>>tx
>>
>>marcos oliva