time ÊÇ´òµç»°µÄ¿ªÊ¼Ê±¼ä£¬ÈÕÆÚ¸ñʽ¾«È·µ½ºÀÃ룬cost ÊÇ´òµç»°µÄ·ÑÓ㬠period ÊÇ´òµç»°µÄʱ³¤£¬µ¥Î»ÊÇÃ룻 ÏÖÔÚÒª¶ÔÕâ¸ö±í°´ÈÕ½øÐÐͳ¼Æ£¬¼´Í³¼Æ±ístaÖÐtime ×Ö¶ÎÊǾ«È·µ½Ì죬 costÊÇÒ»ÌìÄڵĵ绰µÄ·ÑÓã¬period×Ö¶ÎÊÇ6ÃëÒ»¸ö¼ä¸ô¶ÎÊýÁ¿µÄ×ÜºÏ sta±í×ֶΣº id time cost period
ÔõôÔÚsql²éѯ·ÖÎöÆ÷ÖÐдsqlʵÏÖ£¿£¿£¿²âÊÔÊý¾ÝºÍ½á¹û..... SQL code: --´ó¸ÅдÏ select [time]=DATEPART(DAY,[time]), cost=sum(cost), period=SUM(period)/6 from [call] group by DATEPART(DAY,time)
SQL code: select convert(varchar(10),[time],120) as [time], sum(cost) as cost,sum(period) as period from call group by convert(varchar(10),[time],120)