I am using this query:
select city, length(city)
from station
where length(city) = (select max(length(city)) from station )
OR length(city) = (select min(length(city)) from station)
order by city asc;
and when I add LIMIT function to my subqueries, because I need exactly one result from that select:
select city, length(city)
from station
where length(city) = (select max(length(city)) from station limit 1)
OR length(city) = (select min(length(city)) from station limit 1)
order by city asc;
then I got error -
ORA-00907: missing right parenthesis
Anybody who has idea where I make mistake with that function. I use Oracle, I tried to use rownum but it didn't help.
When you use max()
then limit
is not required :
select city, length(city)
from station
where length(city) = (select max(length(city))
from station
) OR
length(city) = (select min(length(city))
from station
)
order by city asc;
However, limit
will not support in Oracle
.