我需要获取所选party_id
的用户名,但是我需要插入而不是
party_id
,我尝试使用嵌套子查询,但始终陷入括号。
我选择了这个选项,而不是第二个选择gm.party_id
:
SELECT * FROM (
select gm.party_id, sum(gm.game_out)
from game_record gm
where gm.party_id in (
select cs.party_id
from casino_users cs
where cs.parent_id=get_party_id_from_promo(619)
)
group by party_id
order by sum(game_out) desc
)
WHERE ROWNUM <= 10;
我需要插入此选择:
select username
from casino_users
where party_id in (
select cs.party_id
from casino_users cs
where cs.parent_id=get_party_id_from_promo(619)
)
我还具有从party_id
返回用户名的功能,但是当我尝试对其进行编译时,在第一次选择时会收到无效的标识符错误。
FUNCTION get_top_ten_highscore(p_promo_code number) RETURN WEAK_CUR IS
resault_set weak_cur;
begin
open resault_set for
SELECT * FROM (
select username_from_id (gm.party_id) as party_id, sum(gm.game_out)
from game_record gm
where gm.party_id in (
select cs.party_id
from casino_users cs
where cs.parent_id=get_party_id_from_promo(619)
)
group by party_id
order by game_out desc)
WHERE ROWNUM <= 10;
return resault_set ;
end get_top_ten_highscore;
答案 0 :(得分:0)
您可以使用JOIN
SELECT
select gm.party_id, sum(gm.game_out), cs.username
from game_record gm
INNER JOIN casino_users cs ON cs.parent_id=get_party_id_from_promo(619)
WHERE ROWNUM <= 10;
group by gm.party_id, cs.username
order by sum(game_out) desc
答案 1 :(得分:0)
from collections import defaultdict as dd
nested_dict = dd(lambda: dd(lambda: dd(list)))
for m in model.objects.all():
nested_dict[m.Country][m.State][m.City].append(m.Street)