Philip Mak wrote:
Say I have this query:
SELECT *
FROM topics
ORDER BY lastPostTime DESC;
How would I modify it to answer the question How many rows would be
returned before the row that has topics.id = $x?
I was thinking of something like this:
$xPostTime = SELECT lastPostTime FROM topics WHERE
On Thu, Feb 26, 2004 at 09:50:39AM -0700, Sasha Pachev wrote:
If I understood the problem correctly, the answer to it is actually
undefined. If you order by lastPostTime, the records with the same
lastPostTime value can be returned in any order.
I guess to accomplish your goal you could add
Philip Mak wrote:
On Thu, Feb 26, 2004 at 09:50:39AM -0700, Sasha Pachev wrote:
If I understood the problem correctly, the answer to it is actually
undefined. If you order by lastPostTime, the records with the same
lastPostTime value can be returned in any order.
I guess to accomplish your goal
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
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
Say I have this query:
SELECT *
FROM topics
ORDER BY lastPostTime DESC;
How would I modify it to answer the question How many rows would be
returned before the row that has topics.id = $x?
I was thinking of something like this:
$xPostTime = SELECT lastPostTime FROM topics WHERE id = $x;