sql >> Database teknologi >  >> RDS >> Mysql

Eliminer underforespørgsel for gennemsnitlig numerisk værdi

select 
  name
from 
  (select 
    round((min(LATITUDE) + max(LATITUDE)) / 2) as LATITUDE,
    round((min(LONGITUDE) + max(LONGITUDE)) / 2) as LONGITUDE
   from STATION 
   where DISTRICT_ID = '110' 
     AND NAME LIKE 'Vancouver%') AS center
  inner join STATION s
where
  s.DISTRICT_ID = '110' 
  and s.NAME like 'Vancouver%'
  and s.LATITUDE between center.LATITUDE - 5 and center.LATITUDE + 5
  and s.LONGITUDE between center.LONGITUDE - 5 and center.LONGITUDE + 5


  1. java.sql.SQLException:Ingen passende driver fundet til jdbc:microsoft:sqlserver

  2. Er denne forespørgsel sikker fra sql-injektion?

  3. Oracle Dynamic SQL-eksempel til at indsætte en post ved hjælp af DBMS_SQL

  4. Returner en liste over partitionsskemaer i SQL Server (T-SQL)