How to select all items that have no orders?(that are not on any receipt)

@Query(value="SELECT i.namen" + "FROM item as in" + "INNER JOIN items_receipts as irn" + " ON i.id = ir.item_idn" + "INNER JOIN receipt as rn" + " ON ir.receipt_id = r.idn" + "GROUP BY i.idn" + "HAVING COUNT(r.id)=0" ,nativeQuery = true) List<String> fiveSales(); Why this query doesn’t seem to work? Is it because the count … Read more