您好,我需要幫助來解決如何從撲克手中找到兩對。 我相信我需要計算不同牌的數量,然後根據邏輯判斷它是否爲兩對,其中兩對是包含相同等級的兩張牌,另一等級的兩張牌和一張牌的撲克牌第三等級;我只是不確定如何去做這件事。從一個撲克手中找到一對兩對的mysql
任何幫助表示讚賞。
這裏是我的撲克牌桌
+----------+------+------+------+-----------+-----------+
| cardName | face | type | suit | faceValue | gameValue |
+----------+------+------+------+-----------+-----------+
| AC | no | A | C | 1 | 14 |
| 2C | no | 2 | C | 2 | 2 |
| 3C | no | 3 | C | 3 | 3 |
| 4C | no | 4 | C | 4 | 4 |
| 5C | no | 5 | C | 5 | 5 |
+----------+------+------+------+-----------+-----------+
和撲克牌手
+----------+--------+----+-----+----+----+----+----------+
| playerId | gameId | C1 | C2 | C3 | C4 | C5 | handType |
+----------+--------+----+-----+----+----+----+----------+
| 12789 | 17MET | QH | QS | 3D | 3C | 3H | |
| 12789 | 82SAT | 7C | 4S | 4D | 4C | 3H | |
| 56347 | 03DEC | 6S | 3S | 3H | 3C | 3D | |
| 56347 | 23WSA | KH | 10H | 7H | 3H | AH | |
| 56347 | 30DEC | AC | KH | KD | 3D | 3S | |
+----------+--------+----+-----+----+----+----+----------+
我需要得到最後一行
+----------+--------+----+-----+----+----+----+----------+
| playerId | gameId | C1 | C2 | C3 | C4 | C5 | handType |
+----------+--------+----+-----+----+----+----+----------+
| 56347 | 30DEC | AC | KH | KD | 3D | 3S | |
+----------+--------+----+-----+----+----+----+----------+
最後一行有什麼特別之處?與同一個playerId的其他行有什麼不同? –
它包含正好2對 – eagerzero
你的意思是cardName = c1? – denny