Advertisement
aaa4Alex

Native SQL request

Sep 13th, 2020
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. @Query(value = "SELECT * FROM article a " +
  2.             "WHERE EXISTS (SELECT 1 " +
  3.             "FROM article_category ac " +
  4.             "where ac.article_id = a.id and ac.category_id in ('32', '34')" +
  5.             " having count(*) = 2)", nativeQuery = true)
  6.     List<Article> selectTwoArticleByCategories(Long category1_id, Long category2_id);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement