[英]insert value "man" in column2 if column1 value selected as "male"
[英]fetch column2 value corresponding to column1 maximum,minimum?
是否可以獲取max(column1)的column2值。 幫我。 我要在數據庫中找到對應於max(price)和min(price)的日期。
$str="select MAX(psq_price),MIN(psq_price),AVG(psq_price) from crawl_archives where p_id=2570";
我從此查詢中找到了最大值,最小值。.需要找到與最高價格相對應的日期列。
嘗試這樣的事情:
select *
from <table> t
join (select max(price) as max_price
from <table>
group by <col1>
)a
on a.col1=t.col1
and a.max_price=t.price
嘗試這個
select date , MAX(psq_price),MIN(psq_price)
from mytable
group by date
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.