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.
日付全体を表示する代わりに、日付列の最初の 4 文字のみを表示したい。
SELECT Test.Date From Test
Date を 4 文字に制限したい
これで年が出ます。
SELECT YEAR(Date) as Year FROM Test
または使用することもできますDATE_FORMAT()
DATE_FORMAT()
SELECT DATE_FORMAT(Date, '%Y') as Year FROM Test