Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
緯度、経度、および米国の州フィールドを含む場所のテーブルがあります。各州の平均緯度と経度を選択したいと思います。
次のコードを試していますが、distinct で構文エラーが発生します。
select avg(lat), avg(lon), distinct(state) from tRealtyTrac order by state group by state
個別は必要ありません。州ごとにグループ化すると、いずれにせよ、州ごとに 1 つの結果が得られます
order by 句の前にも group by 句が必要であることを確認してください。
select state, avg(lat), avg(lon) from tRealtyTrac group by state order by state