我想用temp2
和max tot_duration
填充count from temp1
。我使用以下代码进行操作:
insert into analytics_db.charith_prepaid_bcell_temp2
(charged_party,cell_id,tot_duration,tband_count)
select A.*
FROM analytics_db.charith_prepaid_bcell_temp1 A,
(SELECT A.charged_party,B.B,MAX(A.tot_duration) C-- MAX COUNT FOR MAX TIMA BAND CELL
FROM analytics_db.charith_prepaid_bcell_temp1 A,
(SELECT charged_party,MAX(tband_count) B ---- MAX TIME BAND COUNT
FROM analytics_db.charith_prepaid_bcell_temp1
WHERE NVL(tot_duration,0) >0
GROUP BY charged_party) B
WHERE NVL(tot_duration,0) >0 AND A.charged_party = B.charged_party AND A.tband_count = B.B
GROUP BY A.charged_party,B.B) C
WHERE A.charged_party = C.charged_party AND A.tot_duration= C.C AND A.tband_count = C.B
但是temp2
中有重复的条目,其中具有相同的tot_duration
和tband_count
的相同的charged_party
具有不同的单元格ID。如何修复代码,以仅在只有一个条目的最大cell_id
的情况下获取条目?
谢谢
答案 0 :(得分:1)
这可以通过排名函数<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="SummaryRow">
<h1 id="yett">1000$</h1>
</div>
<div>
<label>-187</label>
<input class="switch" type="checkbox" subtractby="187">
</div>
<div>
<label>-27</label>
<input class="switch" type="checkbox" subtractby="27">
</div>
来完成。
row_number