Skip to content
Advertisement

How to add a column to table results, with the number of repeats of a certain value on a row?

For example, we have a table:

and I want to have a following output:

Is there any way to do this?

Advertisement

Answer

Windowing functions are for that very purpose:

We can’t tell if your particular database product supports window functions (you didn’t tell us)

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement