Philip Mak wrote:
On Thu, Feb 26, 2004 at 10:49:08AM -0700, Sasha Pachev wrote:

SELECT COUNT(*)

FROM topics

WHERE lastPostTime > $postTime
OR (lastPostTime = $postTime AND id > $id);

Can you just add id > $id to the where clause?


No, that won't work because id is only used to disambiguate the order
of two rows that have the same lastPostTime.

(This is a forum software where topics.lastPostTime indicates the last
time a topic was posted in. This may be in a different order than the
topics were originally created.)


Then I would use the last query you proposed except rewrite it to use UNION instead of OR to ensure a better use of keys.


--
Sasha Pachev
Create online surveys at http://www.surveyz.com/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to