SQLize Online / PHPize Online

A A A
Share   Donate   Blog   Popular
Copy Format Clear
create table test( date date, `index` int ); insert into test values('2018-12-11', 1); insert into test values('2019-12-12', 1); insert into test values('2018-11-12', 3); insert into test values('2020-12-13', 10); insert into test values('2020-09-13', 54); insert into test values('2021-10-13', 32); insert into test values('2021-11-13', 12); select (select `index` from test where year(date) = '2018' order by date desc limit 1 ) as '2018', (select `index` from test where year(date) = '2019' order by date desc limit 1 ) as '2019', (select `index` from test where year(date) = '2020' order by date desc limit 1 ) as '2020', (select `index` from test where year(date) = '2021' order by date desc limit 1 ) as '2021' ;
Stuck with a problem? Need help? Ask professionals on our Telegram channel!
Join the channel
Your quersion is posted.
Join our Telegram channel and get answers.
Send
Copy