Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with SQL command
Message
De
25/11/2003 20:13:59
 
 
À
25/11/2003 19:33:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00853542
Message ID:
00853557
Vues:
22
Hey Trey,

Thanks. It's a little different than the approach I was working on but I think I like yours better.

Aloha,

James
>you could order by a random number
>
Use theTable
>AFields(laStru)
>Create Cursor cuOutput From Array laStru
>
>** to get possible values
>Select Distinct zip, biztype ;
>  from theTable ;
>  into cursor cuZipBiztype
>
>Scan
>  lcZip=cuzipbiztype.zip
>  lcBiztype=cuzipbiztype.biztype
>
>  ** get 2 random records
>  Select top 2 zip, biztype, other1, other2, Rand()*10 as Ordering ;
>    from theTable ;
>    where zip=lcZip and biztype=lcBizType ;
>    order by Ordering ;
>    into cursor cuRandom
>
>  Select cuOutput
>  Append From DBF("cuRandom")
>EndScan
>
>
>
>
>>Hi All,
>>
>>We have a table with columns for zip and biztype. I need to randomly select two records per zip, per biztype. Is there a simple SQL command to do this?
>>
>>As usual thanks in advance for any help.
>>
>>Aloha,
>>
>>James
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform