我有這個(gè)應(yīng)用程序,java spring boot 和 mysql db。當(dāng)我嘗試運(yùn)行以下查詢時(shí),出現(xiàn)此錯(cuò)誤。 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 回答

喵喵時(shí)光機(jī)
TA貢獻(xiàn)1846條經(jīng)驗(yàn) 獲得超7個(gè)贊
您在兩個(gè)條件之間缺少一些東西offer.name = voucher.offer
,email =:email
可能是 a WHERE
,也許是 a AND/OR
。我猜你想要這個(gè):
@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);
添加回答
舉報(bào)
0/150
提交
取消