If I have a table like this:
UserName | BoardName
-----------------------
Alice Research
Ethan Research
Ethan Gardening
Ethan Movies
Jack Travel
Jack Movies
Tom Gardening
Tom Teaching
Tom Travel
Tom Movies
Tom Study
Can I get results like this using a PL/SQL query?
Alice Research
Ethan Research
Gardening
Movies
Jack Travel
Movies
Tom Gardening
Teaching
Travel
Movies
Study
Notice how there are blank cells after the UserNames? Sorry if the question is not very clear.
I think a GROUP BY query would work but I am not sure.
Please try:
SELECT
case when UserName=lag(UserName) OVER (ORDER BY UserName)
then null
else UserName end UserName,
UserEmail,
BoardName
FROM
YourTable;
SQL Fiddle Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With