如何不显示最大和最小?
我想显示所有价格,但不显示最大和最小价格。
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将
mini()
更改为min()
(假设是 MySQL)。mini()
不是一个函数。另外,你的一些 SQL 没有多大意义。
Change
mini()
tomin()
(assuming MySQL).mini()
isn't a function.Also, some of your SQL doesn't make much sense.