【发布时间】:2019-05-17 05:56:03
【问题描述】:
我有一个自定义查询,用于从 2 个表中删除记录,如下所示
@Repository
public interface RoamingStatusHistoryRepository extends JpaRepository<RoamingStatusHistory, String> {
@Query("DELETE rsh,rs from RoamingStatusHistory rsh inner join RoamingStatus rs on rsh.msisdn = rs.msisdn where TIMEDIFF(NOW(),rsh.createdDate)>'00:00:30'")
public List<Date> deleteByDate();
}
但是在 DELETE IntelliJ 说 from expected got rsh 并且在 rsh 之后出现错误说 alias definition or WHERE expected, got ','
如何解决此问题。上网查了一下,没找到解决办法
【问题讨论】:
-
您不能从两个表中删除。或者您是否设法在数据库上使用 SQL 来做到这一点?
-
是的,查询工作正常
标签: spring-boot jpa crud