[development] Avoiding sub-queries

Darren Oh darrenoh at sidepotsinternational.com
Mon Apr 23 13:18:47 UTC 2007


On Apr 23, 2007, at 12:18 AM, Nedjo Rogers wrote:

>> But in your case I don't see the need for the subquery.
>
> Is this what you're trying to do?
>
> db_result(db_query(db_rewrite_sql('SELECT max(n.nid) FROM {node} n  
> ORDER BY n.nid LIMIT %d'), $count));

That's exactly what I'm trying to do. But I always get the highest  
node ID in the table, rather than the highest in the range. That's  
why I used the sub-query to force the max ID to be selected from  
within the range.


More information about the development mailing list