jpa执行原生sql union bug解决

@Query(value = "SELECT * FROM count_entity where id=-1111 union (SELECT * FROM count_entity where video_name = ?1 AND platform ='腾讯视频' ORDER BY click_date DESC LIMIT ?2)"
+ "UNION"
+ "(SELECT * FROM count_entity where video_name = ?1 AND platform ='爱奇艺' ORDER BY click_date DESC LIMIT ?2)"
+ "UNION"

+ "(SELECT * FROM count_entity where video_name = ?1 AND platform ='芒果TV' ORDER BY click_date DESC LIMIT ?2)", nativeQuery = true)


union前面需要连接一个空数据查询,因为union 第一个查询不能用()

你可能感兴趣的:(JPA)