List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:May 8 2003 2:50pm
Subject:Re: A seroius trouble with MySQL
View as plain text  
In the last episode (May 08), Nitin Nanivadekar said:
> i am using mysql 3.23 on a machine with 150MB HDD and 96 MB ram. i've
> already mailed you about some problems regarding mysqld functioning. 
> now i am getting a serious problem.
>
> 1. the max () keyword reports 'different' resultsets
> when following queries are sent to it,
> 	a. select max(id) from table1;
> 	b. select max(id) from table1 where id2=100;
> in any condition (like the low resources etc.) i should not get
> different results from seemingly identical queries.

Those queries are not identical.  What if your table looks like this:

id | id2
---+----
1  | 100
2  | 99

Query a) will return 2, query b) will return 1.
 
> 2. i will also point one observation when i was
> hacking the max () function. when there is an empty
> set max() reports Null. this makes max() limited to
> arithmatic ops only. i am using max() to find the next
> incremental primary key index for some other table. 
> i am now seriously considering NOT using max() for
> that reason after 1,. and 2. above.

When there is an empty set, what can max() possibly return except NULL?

-- 
	Dan Nelson
	dnelson@stripped
Thread
A seroius trouble with MySQLNitin Nanivadekar8 May
  • Re: A seroius trouble with MySQLBrian Reichert8 May
    • Re: A seroius trouble with MySQLCurtis Maurand12 May
  • Re: A seroius trouble with MySQLDan Nelson8 May
  • Re: A seroius trouble with MySQLKeith C. Ivey8 May
  • re: A seroius trouble with MySQLEgor Egorov10 May