我正在尝试执行下一个:
em.createQuery("SELECT processId FROM (SELECT processId FROM table_name WHERE processName like '%abcaccz%')")
但是我得到了:
Method threw 'java.lang.IllegalArgumentException' exception.
unexpected token: ( near line 1, column 23
这里缺少什么? (这在我的数据库客户区域中起作用。)
答案 0 :(得分:1)
正确的语法是:
em.createQuery("SELECT processId = (SELECT processId FROM table_name WHERE processName like '%abcaccz%') FROM table_name")
或:
em.createQuery("
SELECT processId
FROM table_name
WHERE processId IN (SELECT processId
FROM table_name
WHERE processName like '%abcaccz%')")