Mpu Gondrong wrote:

Selasa, 17/12/2002 7:38:52, Daniel menulis:

DK> What's wrong with using: order by MyIndex DESC

If I have 100 rows and mysql calculates with desc got 90 or more
(>30%) rows, index won't be used. I have thousand rows, and just want
to get the last row. Without index, this is horrible. Or Am I wrong ?

Tertanda,
Oguds [36856104]

You can use max() to get the biggest Primary Key value, and then select the row with that primary key.
Or you can use:
select * from MyTable order by MyIndex DESC limit 1

--
Daniel Kasak
IT Developer
* NUS Consulting Group*
Level 18, 168 Walker Street
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: www.nusconsulting.com


---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Reply via email to