How can I get the complete list of all book categories in the table?
P粉681400307
P粉681400307 2024-03-28 19:11:27
0
1
364

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:

  • XXX (once only)
  • YYY
  • ZZZ

P粉681400307
P粉681400307

reply all(1)
P粉745412116

You can view

@Query annotation @lemon provided the solution

@Query("SELECT DISTINCT category FROM Books")
List categories();

You can also check this

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template