Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 java jpa hibernate 中的选择查询有问题。我正在尝试获取不在指定组中的学生列表,但对组的分配在另一张桌子上。
这是我尝试过的,但它不起作用:
SELECT e FROM Student e WHERE e != (SELECT c.student FROM listaOsob WHERE c.grupa = :grupa)
您没有声明 alias c。您需要使用NOT IN来检查特定项目是否是NOT IN一组项目。
c
NOT IN
就像是
SELECT e FROM Student e WHERE e NOT IN ( SELECT c.student FROM listaOsob c WHERE c.grupa = :grupa)
应该做的伎俩。