Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL help
Message
De
21/02/2001 19:22:46
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00478235
Message ID:
00478240
Vues:
22
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform