我为表提供了一个表,其中包含不同的发布者记录,每个记录都有一个类型为timestamp的列中的日期.
id | id_publisher | date
1 1 11/2012 03:09:40 p.m.
2 1 12/2012 03:09:40 p.m.
3 2 01/2013 03:09:40 p.m.
4 3 01/2013 03:09:40 p.m.
5 4 11/2012 03:09:40 p.m.
6 4 02/2013 03:09:40 p.m.
7 4 02/2012 03:09:40 p.m.
Run Code Online (Sandbox Code Playgroud)
我需要计算每个发布者每个月发布的记录数量.例如
Month | id_publisher | num
11/2012 | 1 | 1
11/2012 | 2 | 0
11/2012 | 3 | 0
11/2012 | 4 | 1
.....
02/2013 | 4 | 2
Run Code Online (Sandbox Code Playgroud)
我尝试使用raw_occurrence_record group by month(date)中的select count(id),id_publisher;
但是,不要工作.
我有一个带有时间戳字段的表.我如何获取过去3个月的数据?
特别是,3月是我当前的月份,比如03/2012.我需要返回3月,2月和1月份的记录.
我试图在空字段中设置一个默认值,以便将文档保存在MongoDB中
在我的例子中,这是mongoose模式
var Distribution = new Schema({
temporalCoverage: {
startDate: {type: Date, default: Date.now},
endDate: {type: Date, default: Date.now}
},
distributionText: String
});
Run Code Online (Sandbox Code Playgroud)
这是要保存的文件:
"distribution": {
"temporalCoverage": {
"endDate": "",
"startDate": ""
},
"distributionText": "test"
}
Run Code Online (Sandbox Code Playgroud)
在本文档中,空字段为endDate和startDate.该文档以空值保存在mongoDB中.
"distribution": {
"temporalCoverage": {
"endDate": null,
"startDate": null
},
"distributionText": "test"
}
Run Code Online (Sandbox Code Playgroud)
我想保存默认值,而不是null
如果在模式中放置所需的字段,temporalCoverage : { startDate : { type: Date, required: true, default: Date.now }, endDate : { type: Date, required: true, default: Date.now } }我会得到错误验证,并且文档没有保存.
我有这个示例表
<table border="1" id="tabla">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我尝试使用Jquery动态添加内容
$("#tabla").find('tfoot').append($('<td><b>Total</b></td><td>a</td><td>b</td>'));
Run Code Online (Sandbox Code Playgroud)
但是,不行
如果使用萤火虫检查桌子,这有一个脚,但空.¿如何在没有添加内容的情况下动态添加内容到tfoot?
如果我有一个网址为www.example.com的网站,是否可以使用子域名www的另一个子域名?例如www.extra.example.com.我不确定这一点.
我试图找到一些信息,但我在这方面没有足够的经验