You need to provide the table alias in your inner queries
SELECT
. Add an alias after the closing bracket of the
FROM
clause subquery, i.e. each subquery in brackets must be given an alias (
AS
something)
Derived table is:
FROM ( subquery )
Above needs an alias, like:
FROM ( subquery ) AS anyName
Try:
select
pno, count(*)
from
works_on
group by
pno
having
count(*) = (
select
min(CNT)
from (
select
pno, count(*) as CNT
from
works_on
group by
pno
) AS innerTable
);