I have a user work table it contain lot of things.But I want to find how many pieces of material taken by user through userId, But My Custom query not able to work what I want. My table Name Is User_work It contain 6 column. pieces and userId these two column present inside this table this is my custom Query
package com.nilmani.workmanagement.repository
import com.nilmani.workmanagement.entity.UserWork
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.web.bind.annotation.RequestParam
interface MaterialReturnRepository : JpaRepository<MaterialReturnRepository,Long> {
@Query("select u from UserWork where u.pieces =? u.userId=userId")
fun findTotalPiecesOfMaterial(@RequestParam(" pieces")pieces:Long,@RequestParam("userId")userId:Long):UserWork
}
I face issue while create select SQL QUERY