I have a little problem in mi project, i'm trying to make a query on a single table but I'm not succeeding.
The table is this:

```
CREATE TABLE PARTITA(
COD_SFIDA VARCHAR (20) PRIMARY KEY,
DATA_P DATE NOT NULL, 
RISULTATO CHAR (3) NOT NULL,
COD_DECK_IC VARCHAR (15),
COD_DECK_FC VARCHAR (15),
COD_EVT VARCHAR (15),
TAG_USR_IC VARCHAR (15),
TAG_USR_FC VARCHAR (15),
CONSTRAINT CHECK_RISULTATO CHECK (RISULTATO='0-0' OR RISULTATO='0-1' OR RISULTATO='1-0' OR RISULTATO='1-1'),
CONSTRAINT FK8 FOREIGN KEY (COD_DECK_IC, TAG_USR_IC) REFERENCES DECK (COD_DECK, TAG_USR) ON DELETE CASCADE,
CONSTRAINT FK17 FOREIGN KEY (COD_DECK_FC, TAG_USR_FC) REFERENCES DECK (COD_DECK, TAG_USR) ON DELETE CASCADE,
CONSTRAINT FK9 FOREIGN KEY (COD_EVT) REFERENCES TORNEO (COD_EVENTO) ON DELETE CASCADE
);

```

I would like to view the most used deck by each user.

this is the query I tried to do:

```
SELECT  P.COD_DECK_FC, P.TAG_USR_FC, COUNT(P.COD_DECK_FC)
FROM PARTITA P
GROUP BY P.TAG_USR_FC, P.COD_DECK_FC
UNION
SELECT  P.COD_DECK_IC, P.TAG_USR_IC, COUNT(P.COD_DECK_IC)
FROM PARTITA P
GROUP BY P.TAG_USR_IC, P.COD_DECK_IC
/

```

But I would like to view just the most used deck by each user and don't all the decks and how many times users used them.
How can I do?

I would like the query to show the tag\_usr and the cod\_deck that is used the most for all of this for each user
eg:

```
cod_deck         tag_usr  count(cod_deck)
-------------  ----------- --------------
1                 A1BE2      5
2                 AE3NF      6
5                 FNKJD      3

```

instead the previious query returns to me:

```
cod_deck         tag_usr  count(cod_deck)
-------------  ----------- --------------
1                 A1BE2      5
2                 AE3NF      6
5                 FNKJD      3
2                 A1BE2      2
1                 AE3NF      3

```

I just want that the query show me the users A1BE2 and AE3NF just one time, because the query have to select the most used deck of each user.