如何获得基于日的平均重量? [英] how to get avg weight based on day?

查看:68
本文介绍了如何获得基于日的平均重量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示平均重量...仅基于上个月的星期日日期...

 sno名称重量日期avgweight 
1 aaa 100 06/07/2014
1 aaa 200 13/07/2014 200 ' sa 3 sunday' s avg weight)
1 aaa 300 20/07/2014





如何根据周日获得平均体重...

我怎么能得到这个..



请帮帮我?

解决方案

< blockquote>您好,



查看此链接 [ ^ ]。并寻找平均()。





希望这对你有帮助。





干杯


您好,您可以使用类似下面的查询并进行改进,



  SET   DATEFIRST   1 ; 
选择 avg(权重)来自 your_table
DATEPART(dw,日期





函数

 DATEPART(dw,date)

返回1到7之间的数字,其中1表示星期一,7周日


I want to display avg weight..based on last month sunday dates only...

sno    name     weight     date     avgweight
1      aaa       100    06/07/2014     
1      aaa       200    13/07/2014     200(it's a 3 sunday's avg weight)
1      aaa       300    20/07/2014    



how to get average weight based on sunday...
how can i achive this..

please help me?

解决方案

Hi,

Check this Link[^]. And look for Avg().


Hope this will help you.


Cheers


Hi, You can use something like the query below and improve it,

SET DATEFIRST 1;
select avg(weight) from your_table
group by DATEPART( dw, date)



The function

DATEPART( dw, date)

returns a number from 1 to 7 where 1 is Monday and 7 Sunday


这篇关于如何获得基于日的平均重量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆