我想在mysql中获取每一天的最后一条记录.Location<id, date, place_id>
table每天有多个条目.此Location表具有place_id和插入place_id的时间.
另外考虑如果place_id不存在则返回具有place_id的倒数第二条记录.在下表中NULL, '2016-04-06 18:52:06'
记录我们将返回'13664', '2016-04-06 12:57:30'
,这是'2016-04-06'(3月6日)的第二个记录,并且有place_id.
还有一件事,在一天中,会有更多的place_id,请参阅下表.
id || place_id || date
'1', '47', '2016-04-05 18:09:37'
'2', '48', '2016-04-05 12:09:37'
'3', '13664', '2016-04-06 12:57:30'
'4', '9553', '2016-04-08 10:09:37'
'5', NULL, '2016-04-06 18:52:06'
'6', '9537', '2016-04-07 03:34:24'
'7', '9537', '2016-04-07 03:34:24'
'8', '656', '2016-04-07 05:34:24'
'9', '7', '2016-04-07 05:34:57'
Run Code Online (Sandbox Code Playgroud)
当我运行以下查询时,它返回以下结果
查询我运行以下查询,但它给了我错误的结果
`Location<id, place_id, date>`
select L1.place_id, L1.date from
Location1 L1
Left join
Location1 L2
on
Date(L1.date) = Date(L2.date)
And
L1.date < L2.date …
Run Code Online (Sandbox Code Playgroud) ui-view不适用于ui-tab.请看情景,并告诉我哪里错了.
在客户页面中,我通过点击任何客户customers.view.html来呼叫页面更新客户,此页面包含客户列表.当我点击任何客户时,它会像下面的网址一样打开链接.http://localhost:3000/home/#/updatecustomer/5
customers.view.html
<a><i ui-sref="home.updatecustomer({ customerId: {{customer.id}} })" class="fa fa-edit pull-right" ng-click="$event.stopPropagation()"></i></a>
Run Code Online (Sandbox Code Playgroud)
在配置中,我正在创建网址http://localhost:3000/home/#/updatecustomer/5
,我可以打开页面index.html,但查看相应的配置文件和设置没有打开...
请参阅类似的工作演示,工作演示
" 配置 "
.state('home.updatecustomer', {
url: 'updatecustomer/:customerId',
views:{
'':{
templateUrl: 'addcustomer/index.html',
controller: 'TabsDemoCtrl',
},
'profile':{
templateUrl: 'addcustomer/profile.html'
},
'setting':{
templateUrl: 'addcustomer/setting.html'
},
}
})
Run Code Online (Sandbox Code Playgroud)
调节器
var app = angular.module('app') ;
app.controller('TabsDemoCtrl', TabsDemoCtrl);
TabsDemoCtrl.$inject = ['$scope', '$state'];
function TabsDemoCtrl($scope, $state){
$scope.tabs = [
{ title:'profile', view:'profile', active:true },
{ title:'setting', view:'setting', active:false }
];
}
Run Code Online (Sandbox Code Playgroud)
的index.html
<uib-tabset …
Run Code Online (Sandbox Code Playgroud)