Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with SQL

Status
Not open for further replies.

jackz15

Programmer
Jun 28, 2006
103
US


My program is basically a study program for vocabulary. You can insert new vocabs with its def, delete vocabs, search vocabs,a listing funtion to list all the vocab(this is ny problem), and there is even a pop quiz function which randomly picks a vocab to quiz the user. Of course with Kirsle's help I managed to make all the outputs voiced.
now its ok to list all the vocab from the database, if you only have less than 100 so far. But once you get into the 1000s range, it will be ugly and slow. By the way, in my code if you enter '@' it calls for this list.
What i want:
And after @ there should be the vocab that you want to start with, my sql code should be able to select everything in the database AFTER the vocab i entered, and NOT before it. The results must be limited to 50.
I know I could use LIMIT but I'd have to find the row number of the vocab first! And to do that, i'd have to select everything! Is there a way to bypass this?


 
Do you mean you would have the vocabulary name after the @, like "@abc"? That would be simple to code, and not at all slow, assuming you have an index on that field.

You might use something like:
[tt]
SELECT *
FROM vocabs
WHERE vocabname>='abc'
ORDER BY vocabname
LIMIT 50
[/tt]
 
so that code just selects abc which exist somewhere in the database, and then takes 50 more rows after it and NOT what was before abc? I'll go try this, hopefully it works. I guess i just never knew that you could do this, I'm gussing the key thing that you used is '>=' i'm actually not familiar with this sign.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top