Gossamer Forum
Home : General : Databases and SQL :

msqk "limit"

Quote Reply
msqk "limit"
when using "limit 10" , the scirpt will only return first 10 record, what about i need to fetch back the last 10 record which should be combine with where condition. the total row is unsure as the entery is adding day by day.



Thanks
Quote Reply
Re: [courierb] msqk "limit" In reply to
you need to do a reverse sort on some field... for example:
Code:
select * from table where this="that" order by this desc limit 10

--Philip
Links 2.0 moderator
Quote Reply
Re: [sponge] msqk "limit" In reply to
Pugdogs modified Search Logger displays the first searches in the table always, rather than the last...

I wonder if I could use this type of reverse statement to modify his plugin to display the last records in the table. Sorry, I should really post this under 'Plugins and Globals'.
Quote Reply
Re: [sponge] msqk "limit" In reply to
weather it is possible to use count(*), "limit" to make a code to have query result

span pages.

for example

result of 1-5, 6-10, 11-15.....

or

page 1, page 2, page 3





Thanks
Quote Reply
Re: [courierb] msqk "limit" In reply to
There was a thread posted awhile back by "sponge" or "Wil" regarding spanning page codes to work with MySQL results.

Using LIMIT with COUNT functions is not the ultimate answer. Basically, what you would need to do is get all results based on user or system parameters, then you would perform calculations against the total results.

Example: (from LINKS SQL v.1.13)

Quote:

($DBOBJ->hits > 10) and ($span = $LINKDB->toolbar());


Re-executing your query, even if you save the query in cache, would be server resource intensive.

You can look in LINKS SQL for the toolbar subroutine, which basically calculates the hits by the maximum hits allowed per page.

Hope this helps.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] msqk "limit" In reply to
Thanks for the reply.

However i explored "sponge" or "Wil" 's recent post, still could not find it.

do a general search on post only, find discussion related to link.

Hope could find it soon
Quote Reply
Re: [courierb] msqk "limit" In reply to
http://gossamer-threads.com/..._string=span;#187757

Keywords: Paul + Span