On 28 Mar 2003 at 10:08, Steve Phillips wrote: > SELECT sum(bytes) FROM tb_ipdata_0303 WHERE (source_ip > 3329275903 AND > source_ip < 3329276160) OR (dest_ip > 3329275903 AND dest_ip < 3329276160) > AND (time > 1048802400 AND time < 1048805999);
Using "OR" like that prevents indexes from being used. You might be better off with two separate queries. Moreover, if you're going to use "OR" you might want to add some parentheses to make sure the criteria are being combined in the way you think they are. "a OR b AND c" is equivalent to "a OR (b AND C)", not "(a OR b) AND c". -- Keith C. Ivey <[EMAIL PROTECTED]> Tobacco Documents Online http://tobaccodocuments.org Phone 202-667-6653 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]