我有这个应用程序,java spring boot 和 mysql db。当我尝试运行以下查询时,出现此错误。 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'email ='rahul@gmail.com.com'' at line 1有谁知道为什么吗? @Query(value = "SELECT voucher_code FROM voucher INNER JOIN " + "offer ON offer.name = voucher.offer " + " email =:email", nativeQuery = true) List<Voucher> getVouchers(@Param("email") String email);
1 回答
喵喵时光机
TA贡献1846条经验 获得超7个赞
您在两个条件之间缺少一些东西offer.name = voucher.offer
,email =:email
可能是 a WHERE
,也许是 a AND/OR
。我猜你想要这个:
@Query(value = "SELECT voucher_code FROM voucher INNER JOIN " + "offer ON offer.name = voucher.offer " + "WHERE email =:email", nativeQuery = true) List<Voucher> getVouchers(@Param("email") String email);
添加回答
举报
0/150
提交
取消