[英]SQL date scenario for getting previous month's data to-date on the 1st of month, then drop last month
[英]Oracle SQL - only last reading before the 1st of next month
所以你想要這樣的東西嗎?
select number, to_char(sysdate, 'Mon-YYYY') as month_year,
max(reading) keep (dense_rank first order by modified_date_time desc) as reading
from t
group by number;
每個數字的最新讀數以及格式為 Mon-YYYY 的當前日期。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.