Q:

Oracle SQL "FROM keyword not found where expected"

I keep getting the "FROM keyword not found where expected" error pointing at line 1 when I try to run the following statement:
SELECT Physician.Last_Name, Physician.First_Name, (SELECT COUNT (DISTINCT Patient_ID)), AS Unique_PTS
FROM Visit
JOIN Physician
          ON Visit.Physician_ID = Physician.Physician_ID
GROUP BY Physician.Last_Name, Physician.First_Name
ORDER BY Unique_PTS DESC;

The error specifically highlights Patient_ID))and I'm having trouble figuring out the fix.

A:

It's the (SELECT COUNT(DISTINCT patient_id)), which oddly enough, does not have a FROM keyword :-).  I presume you really should lose the SELECT and just have COUNT(DISTINCT patient_id).
SELECT Physician.Last_Name, Physician.First_Name, COUNT (DISTINCT Patient_ID) AS Unique_PTS
FROM Visit
JOIN Physician
          ON Visit.Physician_ID = Physician.Physician_ID
GROUP BY Physician.Last_Name, Physician.First_Name
ORDER BY Unique_PTS DESC;

