I have a "Books" table that looks like this:
I'm trying to make a Spring Boot application that lists all these books but you can filter them by category. To do this, I want to display a list of each category so the user can click on the category they want.
What is a better way to get a list of this category? For example, in the case of the picture above, I want to display a list like this:
P粉7454121162024-03-29 15:54:26
You can view
@Query annotation @lemon provided the solution
@Query("SELECT DISTINCT category FROM Books") Listcategories();
You can also check this