我写了个类似的SQL好像没有错啊

解决方案 »

  1.   

    可能是数据精度问题.
    你先将子查询拆开来执行看看有没有结果
    即:
    select max(price) from shop;
    如果有结果再执行下面的语句
    select article,dealer,price from shop where price=?;
    看看有没有结果.下面是5.0手册上的一个例子,说明数据类型的不准确存储mysql> use test;
    Database changed
    mysql> delimiter //
    mysql> create procedure p()
        -> begin
        -> declare i int default 0;
        -> declare d decimal(10,4) default 0;
        -> declare f float default 0;
        -> while i < 10000 do
        -> set d=d+0.0001;
        -> set f=f+0.0001e0;
        -> set i=i+1;
        -> end while;
        -> select d,f,i;
        -> end;
        -> //
    Query OK, 0 rows affected (0.06 sec)mysql> delimiter ;
    mysql> call p();
    +--------+---------+-------+
    | d      | f       | i     |
    +--------+---------+-------+
    | 1.0000 | 1.00005 | 10000 |
    +--------+---------+-------+
    1 row in set (0.09 sec)Query OK, 0 rows affected (0.09 sec)
      

  2.   

    mysql版本是多少?4.1以上才支持子查询。
      

  3.   

    你的是4.3.4?MySQL有这个版本号吗,现在4的版本号不是才4.1.18?
    MySQL4还不支持存储过程,要5.x才支持,我给的例子你当然会出错了,我是想告诉你在MySQL里有些数据类型是不能准确存储的.
      

  4.   

    Sorry, 我说错了,那是我的php版本号,我的是的mysql是4.0的,谢谢你们啊!