SQL / JPQL选择小于或等于的地方

时间:2016-03-02 11:16:35

标签: sql jpql

我正在为汽车编写预订系统,我想根据这些因素创建一个返回所有汽车的查询,这是我的代码:

SELECT * FROM Car WHERE regNbr NOT LIKE 
(SELECT regNbr FROM Booking WHERE (startDate <= '20160422' AND endDate >= '20160422')
OR startDate <= '20160423' AND endDate >= '20160423')
AND model LIKE '%%'AND color LIKE '%%'
AND model LIKE (SELECT name FROM Model WHERE brand LIKE '%%' 
AND price <= 2000 AND seats >= 1 )
AND address LIKE (SELECT address FROM Garage WHERE address LIKE '%Malmö%')

这是我收到的错误消息:

Subquery returned more than 1 value. 
This is not permitted when the subquery follows =, !=, <, <= , >, >= 
or when the subquery is used as an expression.

在旁注中我会在JPQL中使用NativeNamedQuery或NamedQuery吗?

0 个答案:

没有答案