遇到(我的)sql问题...
我有以下数据:
angular.module('hello', [ 'ngRoute' ]).config(function($routeProvider, $httpProvider) {
$routeProvider.when('/', {
templateUrl : 'home.html',
controller : 'home',
controllerAs : 'controller'
}).otherwise('/');
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
$httpProvider.defaults.headers.common['Accept'] = 'application/json';
}).controller('navigation',
function($rootScope, $http, $location, $route) {
var self = this;
self.tab = function(route) {
return $route.current && route === $route.current.controller;
};
$http.get('user').then(function(response) {
if (response.data.name) {
$rootScope.authenticated = true;
} else {
$rootScope.authenticated = false;
}
}, function() {
$rootScope.authenticated = false;
});
self.credentials = {};
self.logout = function() {
$http.post('logout', {}).finally(function() {
$rootScope.authenticated = false;
$location.path("/");
});
}
}).controller('home', function($http) {
var self = this;
$http.get('resource/').then(function(response) {
self.greeting = response.data;
})
});
我正在寻找的结果只是14a,选择它是因为最多的行14a为x_id
答案 0 :(得分:1)
>>> df.data.values
array(['A', 'BBB', 'CC'], dtype=object)
>>> df2.data.values
array([u'AAAAAAA'], dtype=object)
>>> df3.data.values
array(['A', 'BBB', 'CC', u'AAAAAAA'], dtype=object)
答案 1 :(得分:1)
这是一种方法:
SELECT x_id, COUNT(*) as RecordCount
FROM
TableName
GROUP BY
x_id
ORDER BY
COUNT(*) DESC
LIMIT 1
答案 2 :(得分:0)
使用:
选择x_id,从tbl组中计数(x_id)c x_id顺序c DESC;