Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL help
Message
From
21/02/2001 19:22:46
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00478235
Message ID:
00478240
Views:
23
sirr,

Yooo da 'mannn

tx a bunch

>Hi Mark,
>
>How about something like this:
* set up test data
>
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform