I would like to ask how this section of sql should be optimized, and is there any better way?

The

sql statement is as follows

SELECT sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180101 AND CONVERT(varchar(100), b.BillDate, 112) < 20180126 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180126 AND CONVERT(varchar(100), b.BillDate, 112) < 20180226 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180226 AND CONVERT(varchar(100), b.BillDate, 112) < 20180326 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180326 AND CONVERT(varchar(100), b.BillDate, 112) < 20180426 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180426 AND CONVERT(varchar(100), b.BillDate, 112) < 20180526 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180526 AND CONVERT(varchar(100), b.BillDate, 112) < 20180626 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180626 AND CONVERT(varchar(100), b.BillDate, 112) < 20180726 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180726 AND CONVERT(varchar(100), b.BillDate, 112) < 20180826 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180826 AND CONVERT(varchar(100), b.BillDate, 112) < 20180926 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20180926 AND CONVERT(varchar(100), b.BillDate, 112) < 20181026 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20181026 AND CONVERT(varchar(100), b.BillDate, 112) < 20181126 then b.totalmoney else 0 end)AS "",
sum(case when CONVERT(varchar(100), b.BillDate, 112) >= 20181126 AND CONVERT(varchar(100), b.BillDate, 112) < 20181231 then b.totalmoney else 0 end)AS ""
FROM BillIndex as b WHERE 
datepart(year,b.BillDate)="2018" 
AND BillType = 11
AND ifcheck = "t"
AND RedWord = 0
AND Stypeid = "00001";
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36e37-2c030.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36e37-2c030.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?