如何不显示最大和最小?

发布于 2024-12-21 05:10:40 字数 916 浏览 2 评论 0原文

我想显示所有价格,但不显示最大和最小价格。

我正在使用 NOT IN 但它不起作用。

<?php $cod_product = $_GET["cod_product"];

$sql = "SELECT `ppm`
                ,`price`
                ,`market`
                ,`product`
                ,`name_market`
                ,`cod_market`
    FROM ppm, markets
                WHERE product=$cod_product AND cod_market=market NOT IN (SELECT MAX(price), MIN(price) FROM ppm)
                ORDER BY price ASC";

        $result = mysql_query($sql, $connection) or die("fail");

        if ($dados = mysql_fetch_array($result)) {
            do {

                $cod_market = $dados['market']; 
                $nome_mercado = $dados['name_market'];
                $price = $dados['price'];



             echo $price;
            echo $name_market;


            }
            while($dados = mysql_fetch_array($result));
            }else { }
            ?>

I want to show all the price but not the max and mini.

I'm using NOT IN but it's not working.

<?php $cod_product = $_GET["cod_product"];

$sql = "SELECT `ppm`
                ,`price`
                ,`market`
                ,`product`
                ,`name_market`
                ,`cod_market`
    FROM ppm, markets
                WHERE product=$cod_product AND cod_market=market NOT IN (SELECT MAX(price), MIN(price) FROM ppm)
                ORDER BY price ASC";

        $result = mysql_query($sql, $connection) or die("fail");

        if ($dados = mysql_fetch_array($result)) {
            do {

                $cod_market = $dados['market']; 
                $nome_mercado = $dados['name_market'];
                $price = $dados['price'];



             echo $price;
            echo $name_market;


            }
            while($dados = mysql_fetch_array($result));
            }else { }
            ?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三人与歌 2024-12-28 05:10:40

mini() 更改为 min()(假设是 MySQL)。

mini() 不是一个函数。

另外,你的一些 SQL 没有多大意义。

  SELECT cod_ppm
         ,price
         ,market
         ,product
    FROM ppm
   WHERE price NOT IN (SELECT MAX(price), MIN(price) FROM ppm)
ORDER BY price ASC

Change mini() to min() (assuming MySQL).

mini() isn't a function.

Also, some of your SQL doesn't make much sense.

  SELECT cod_ppm
         ,price
         ,market
         ,product
    FROM ppm
   WHERE price NOT IN (SELECT MAX(price), MIN(price) FROM ppm)
ORDER BY price ASC
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文