Sql查询查找过去值的平均值(Sql query to find averages of past values)
我有一些数据可以在一天中以正常的小时间隔记录一个值(卷)到oracle sql数据库。 我正在寻找一个sql查询,可以找到过去发生的平均量,所以我可以根据过去的时间将其插入到新表中。 例如,对于每个星期三晚上7点,只要我的数据集返回,我想找到当时所有星期三晚上7点的平均值,并将平均值输出到新记录。 然后找到星期三晚上8点,然后是晚上9点等的平均录音,直到一周的所有7天都完成。
我主要不确定如何在sql中增加它。 我想我的查询会返回我想要的内容,但我不确定如何增加值并插入。
到目前为止,我在特定日期的特定时段内有这个:
SELECT hour,day,AVG(volume) FROM table WHERE to_char(day, 'D') = 3 and hour = 19 GROUP BY hour,day;
I have some data that logs a value (volume) in regular hourly intervals throughout the day to an oracle sql database. I am looking for an sql query that can find the average volume from occurrences in the past so I can insert that into a new table based on that time in the past. For example, for every Wednesday at 7pm for as long as my dataset goes back, I want to find what the average was at that time for all Wednesdays at 7pm in the past, and output the average to a new record. Then find the average recording for Wednesdays at 8pm , then 9pm and so forth, until all 7 days in a week are complete.
I am primarily unsure of how to increment this in sql. I think I have a query that will return what I want, but I am unsure of how to increment the values and insert.
So far I have this for a particular hour of a particular day:
SELECT hour,day,AVG(volume) FROM table WHERE to_char(day, 'D') = 3 and hour = 19 GROUP BY hour,day;
原文:https://stackoverflow.com/questions/16756969
最满意答案
这可以通过设置来解决......
grails.mime.file.extensions = false
...在Config.groovy中。
似乎Grails试图根据文件名后缀在场景后面做一些MIME魔术。
更新: Grails JIRA的一些其他信息。
这是UrlMappingsFilter.java中的违规代码:
if(WebUtils.areFileExtensionsEnabled()) { String format = WebUtils.getFormatFromURI(uri); if(format!=null) { MimeType[] configuredMimes = MimeType.getConfiguredMimeTypes(); // only remove the file extension if its one of the configured mimes in Config.groovy for (MimeType configuredMime : configuredMimes) { if (configuredMime.getExtension().equals(format)) { request.setAttribute(GrailsApplicationAttributes.CONTENT_FORMAT, format); uri = uri.substring(0, (uri.length() - format.length() - 1)); break; } } } }
WebUtils.areFileExtensionsEnabled()返回Config.groovy中配置的“grails.mime.file.extensions”设置的值。
This can be solved by setting ...
grails.mime.file.extensions = false
... in Config.groovy.
It seems like Grails is trying to do some MIME magic behind the scene based on the file name suffix.
Updated: Some additional info from the Grails JIRA.
This is the offending code in UrlMappingsFilter.java:
if(WebUtils.areFileExtensionsEnabled()) { String format = WebUtils.getFormatFromURI(uri); if(format!=null) { MimeType[] configuredMimes = MimeType.getConfiguredMimeTypes(); // only remove the file extension if its one of the configured mimes in Config.groovy for (MimeType configuredMime : configuredMimes) { if (configuredMime.getExtension().equals(format)) { request.setAttribute(GrailsApplicationAttributes.CONTENT_FORMAT, format); uri = uri.substring(0, (uri.length() - format.length() - 1)); break; } } } }
WebUtils.areFileExtensionsEnabled() returns the value of the "grails.mime.file.extensions" setting configured in Config.groovy.
相关问答
更多-
这可以通过设置来解决...... grails.mime.file.extensions = false ...在Config.groovy中。 似乎Grails试图根据文件名后缀在场景后面做一些MIME魔术。 更新: Grails JIRA的一些其他信息。 这是UrlMappingsFilter.java中的违规代码: if(WebUtils.areFileExtensionsEnabled()) { String format = WebUtils.getFormatFromU ...
-
如何在UrlMappings.groovy中重写Grails中的URI(How to rewrite a URI in Grails within UrlMappings.groovy)[2022-02-26]
根据你的例子,听起来像你正在解决错误的问题。 这里真正的问题似乎是你使用相对链接(例如css/login.css )来静态内容。 当浏览器选择相对链接时,它使用当前URL来确定文件的路径。 但是,如果您使用Grails的resource标记 ,Grails将生成一个锚定到URL根目录的URL。 例如,您的css/login.css链接将成为/myAppName/css/login.css 。 用法如下:grails urlMappings dsl(grails urlMappings dsl)[2021-05-15]
我怀疑methodMissing()是以某种方式参与的。 我只是不知道“/ pages / admin”是否被视为方法名称,或者它是一个字符串并且methodMissing()被混合到String类中。 在这两种情况下,虽然控制器和动作将传递给methodMissing()作为第二个参数,参数。 其余的很容易。 I suspect methodMissing() is somehow involved. I just don't know if "/pages/admin" is considered a ...你将在这里遇到困难,因为$ id和$ action只是变量名,直到它们被分配。 他们不知道你发送的是id或动作,只是url匹配模式。 你可以做这样的事情。 "/workflow/**/$siteId/**/$iteration/**/$action?/$id?" (controller:"*****") 您必须始终指定您的操作, ***/list/123或***/someAction将匹配,但不是***/123 。 你也可以在映射中做一些约束/逻辑来解决问题,但这可能会有点混乱。 You are goin ...这与内容协商有关,您可以在Grails用户指南的第6.8节中阅读。 如果Grails将扩展名识别为特定类型,则会从URL中删除扩展名,并将类型添加到“format”参数中。 您可以通过将此条目添加到grails-app/conf/Config.groovy来禁用此行为: grails.mime.file.extensions = false This is related to content negotiation, which you can read about in section 6.8 of ...要做到这一点,您首先需要知道Grails在底层使用Spring Web。 Spring Web是我能想到的最复杂的Web框架(能够做AFAIK)。 无论如何,重要的是要知道Spring Web的请求生命周期是如何工作的。 您可以通过阅读Spring Web中的主要Servlet“DispatcherServlet”的文档(以及Grails中的文档)来了解它: http : //docs.spring.io/spring/docs/current/javadoc-api /org/springframewor ...我认为旧行为是一个错误,新行为是首选。 像//这样的空路径段应该解决为空,并且所有以下URL应该是等价的: http://host/foo/bar http://host/foo//bar http://host/foo/./bar RFC3986讨论了URI语法。 您可以使用像0这样的虚拟值作为“缺失”组件的占位符。 I consider the old behavior a bug and the new behavior as preferred. Empty path segements like ...Grails - 只获取URL参数(Grails - Only get URL params)[2022-04-02]
我认为您可以做的最好的事情是删除您知道但不想看到的参数: def getPerson(){ render params.findAll { !(it.key in ['action', 'controller', 'method']) } } I think the best you can do is to remove the parameters that you know about and do not want to see: def getPerson(){ ...你应该做 "/"(controller: 'home', action: 'home') You should do "/"(controller: 'home', action: 'home')Grails i18n UrlMappings(Grails i18n UrlMappings)[2021-10-05]
URLMapping块是dsl,但您可以在其中使用Groovy。 你可以这样做: ['contact', 'kontact'].each{ "/${it}"( view: "/blah") } 这确实创造了你要求的路线。 这个例子非常简单,但你可能会像i18n消息包那样挂钩做类似的事情 getKeysFor( 'contact' ).each{ ... your mapping here } 感觉这是你的控制器应该处理的东西,因为i18n支持可能比url映射级别更好。 我很确定这会破坏你 ...相关文章
更多- Solr 使用自定义 Query Parser
- Solr 使用自定义 Query Parser
- MongoDB学习 (五):查询操作符(Query Operators).1st
- 如何用Hadoop计算平均值
- 常用HQL(Hibernate Query Language)查询
- solr学习笔记二-------solr query查询的参数
- Mysql错误:Ignoring query to other database解决方法
- could not find system property or JNDI
- solr delete query
- solr delete query
最新问答
更多- h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
- 创建一个功能(Create a function)
- 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
- PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
- Qt冻结循环的原因?(Qt freezing cause of the loop?)
- TableView重复youtube-api结果(TableView Repeating youtube-api result)
- 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
- SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
- 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
- 以编程方式创建UITableView(Creating a UITableView Programmatically)
- 如何打破按钮上的生命周期循环(How to break do-while loop on button)
- C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
- 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
- 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
- Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
- 设置kotlin扩展名(Setting a kotlin extension)
- 如何并排放置两个元件?(How to position two elements side by side?)
- 如何在vim中启用python3?(How to enable python3 in vim?)
- 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
- 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
- Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
- dedecms如何安装?
- 在哪儿学计算机最好?
- 学php哪个的书 最好,本人菜鸟
- 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
- 如何覆盖错误堆栈getter(How to override Error stack getter)
- 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
- USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
- 电脑高中毕业学习去哪里培训
- 正则表达式验证SMTP响应(Regex to validate SMTP Responses)