0
SELECT t.*
from (
select ig_idx, count(ig_root) over(partition by ig_root) AS GameCount1,
ig_root,ig_game_type,
row_number() over (partition by ig_root order by ig_root asc) as seqnum
from Info_Game) AS t
ORDER BY ig_root,ig_idx ASC
ig_idx GameCount1 ig_root ig_game_type seqnum
--------------------------------------------------
419754 3 2409758 12 1 <-- ig_game_type is 12 or 1x2
419755 3 2409758 ah 2
419756 3 2409758 ou 3
419757 1 2409775 12 1
我不想讓這個
418265 5 2421498 1h_ah 1 <-- ig_game_type is not 12 or 1x2 418266 5 2421498 2h_ou 2 418267 5 2421498 ah 3 418268 5 2421498 ou 4 418269 5 2421498 1h_ou 5
417618 5 2421579 1x2 1 <-- ig_game_type is 12 or 1x2
417619 5 2421579 1h_ah 2
417620 5 2421579 ah 3
417621 5 2421579 ou 4
417622 5 2421579 1h_ou 5
如果SEQNUM爲1但不ig_game_type 12或1×2 我不想得到它。 我想要一個結果。
ig_idx GameCount1 ig_root ig_game_type seqnum
--------------------------------------------------
419754 3 2409758 12 1
419755 3 2409758 ah 2
419756 3 2409758 ou 3
419757 1 2409775 12 1
417618 5 2421579 1x2 1
417619 5 2421579 1h_ah 2
417620 5 2421579 h 3
417621 5 2421579 ou 4
417622 5 2421579 1h_ou 5
我沒有看到你想要的結果與你的病情有什麼關係。在那裏做什麼是「ou」/「4」?那不符合你的條件。 –
「我不想導入,除非seqnum是1,ig_game_type是12或1x2。」但是你想要的結果包含seq num,而不是上面提到的語句中的1和game_type。請糾正陳述或期望的結果。 –
你在找這個嗎? (from Info_Game)AS t ORDER BY ....' - >'from Info_Game)as t WHERE NOT(seqnum = 1 AND ig_game_type IN('12','1x2')ORDER BY ...' – Alex