This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-16. For the latest, interactive version please visit https://mariadb.com/kb/.

How to count items for a specific ordernation

Hi everyone,

This is my table:

PACKAGE_ID | ITEM_ID 1 1 1 2 1 3 2 4 2 5 3 6 4 7 4 8

I want a new column called count that count 1 to N according to package ID. E.g.: PACKAGE_ID | ITEM_ID | COUNT 1 1 1 1 2 2 1 3 3 2 4 1 new package 2 5 2 3 6 1 4 7 1 4 8 2

Thanks!

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.