Skip to content

Hide data for all but first row on left join column

Let’s say I have this query for a view:

and it produces this output:

All good so far, but I’d like to hide the duplicates in the left row:

That makes is easier to read IMO, and it’s the formatting I want for this view.

How can I achieve this?

Advertisement

Answer

Well, this can be implemented by a window function, if the database what you use now supports this feature such as PostgreSQL or MySQL of high version(8.0+), you can write the SQL as below:

Or the database does not support window function, you can write as below:

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