Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Doubts on mysql syntax
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows XP
Database:
MySQL
Miscellaneous
Thread ID:
00993594
Message ID:
00993703
Views:
14
This message has been marked as the solution to the initial question of the thread.
Do you have a primary key (pk) in your table?

Here is maybe what I would do:
1. Select all records from table (select myPK from myTable)
2. Draw a pk at random, myRandomPK
3. Select entire record where pk condition is met (select * from myTable where myPK = myRandomPK)

Einar

>>I am unsure what you are trying to accomplish. Could you please explain a little more?
>>
>1. draw a randon number among 1 and the number of records
>2. go to the found record number
>3. grab it data and process
>
>>>
>>>Thanks for your repli.. I have a routine to calculate a number (makes a draw) and to skip to that specific number.. So, on this case the best (or the only) option will be:
>>>
>>>
>>>nwret=SQLexec(privCone, "SELECT * FROM `mytable` limit "+allt(str(nmydraw))+",1)"
>>>
>>>
>>>Is that right ? Or that is anything better ?
>>>>>
>>>>>
>>>>>nReco = 10
>>>>>goto nReco
>>>>>
>>>>>
>>>>>Is there something similar on mysql for the above issue ?
>>>>>
>>>>>What about reccount() !! Only using "select count(*).." or there is some other way to have it ?
>>>>>
>>>>>TIA
>>>>>
>>>>>Claudio
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform