Home Backend Development PHP Tutorial MYSQL 排名排序有关问题

MYSQL 排名排序有关问题

Jun 13, 2016 pm 01:24 PM
event rank

MYSQL 排名排序问题
SELECT sum( `yb2000_event_point` ) , `yb2000_event_phone`, `yb2000_event_riqi` FROM yb2000_event WHERE yb2000_event_riqi LIKE '%2012%' GROUP BY yb2000_event_phone order by sum( `yb2000_event_point` ) desc 

用这语句查出来了 用户的一年积分总排行 可是我想加个 条件 查出来某人的 积分数和排行 可是排行没法取 个位 大师 请教下

------解决方案--------------------
SET @rank =0;
select * from (SELECT @rank := @rank +1 AS rank, yb2000_event_phone, yb2000_event_point,user_id
FROM yb2000_event
GROUP BY yb2000_event_phone
ORDER BY yb2000_event_point)a where a.user_id='user_id'
给我分嚓

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Event processing library in PHP8.0: Event Event processing library in PHP8.0: Event May 14, 2023 pm 05:40 PM

Event processing library in PHP8.0: Event With the continuous development of the Internet, PHP, as a popular back-end programming language, is widely used in the development of various Web applications. In this process, the event-driven mechanism has become a very important part. The event processing library Event in PHP8.0 will provide us with a more efficient and flexible event processing method. What is event handling? Event handling is a very important concept in the development of web applications. Events can be any kind of user row

Steam Summer Sale - Valve teases 95% off AAA games, confirms discounts for viral games Palworld and Content Warning Steam Summer Sale - Valve teases 95% off AAA games, confirms discounts for viral games Palworld and Content Warning Jun 26, 2024 pm 03:40 PM

Steam's Summer Sale has previously played host to some of the best game discounts, and this year seems to be stacking up for another home run by Valve. A trailer (watch below) teasing some of the Steam Summer Sale discounted games was just released i

What is the function of rank function? What is the function of rank function? Jul 18, 2022 pm 03:20 PM

The function of the rank function is to rank the data; the rank function is one of the basic functions of Excel and can return the ranking of the specified field value in the result set partition. The ranking of the specified field value is the ranking before the relevant row plus one. The syntax is: "RANK(number,ref,[order])".

How to use Pygame's Event event module in Python How to use Pygame's Event event module in Python May 18, 2023 am 11:58 AM

Pygame's Event module Event (Event) is one of the important modules of Pygame. It is the core of building the entire game program, such as commonly used mouse clicks, keyboard taps, game window movement, window resizing, triggering specific plots, and exiting. Games, etc., these can be regarded as "events". Event type Pygame defines a structure specifically used to process events, namely the event queue. This structure follows the basic principle of "first come, first processed" in the queue. Through the event queue, we can process user operations in an orderly and one-by-one manner ( trigger event). The following table lists the commonly used game events in Pygame: Name Description QUIT The user presses the close button of the window ATIVEEVENTPy

Steam Summer Sale trailer teases 95% off AAA game deals, confirms price cuts for Palworld, Stellaris, Content Warning Steam Summer Sale trailer teases 95% off AAA game deals, confirms price cuts for Palworld, Stellaris, Content Warning Jun 26, 2024 am 06:30 AM

Steam's Summer Sale has previously played host to some of the best game discounts, and this year seems to be stacking up for another home run by Valve. A trailer (watch below) teasing some of the Steam Summer Sale discounted games was just released i

How to simulate rank/over function in Java to obtain group ranking How to simulate rank/over function in Java to obtain group ranking May 03, 2023 pm 01:52 PM

Background exam batch class name Chinese 202302 Class 1, Class 3, Zhang Xiaoming 130.00202302 Class 3, Class 1 Wang Erxiao 128.00202302 Class 3, Class 1 Xie Chunhua 136.00202302 Class 3, Class 2 Feng Shijie 129.00202302 Class 3, Class 2 Ma Gongcheng 130.00202302 Class 3, Class 2 Wei Pianpian 136.00 Suppose we With the above data, there is now a need to count the ranking of each student's Chinese subject score in the class and the ranking of the whole year. How will you achieve it? It is easy for us to think of rank()over(). Over() is an analytical function and can be used in conjunction with rank(), dense_rank(), and row_number().

In JavaScript, when the browser window is resized, which event is this? In JavaScript, when the browser window is resized, which event is this? Sep 05, 2023 am 11:25 AM

Use the window.outerWidth and window.outerHeight events to get the window size in JavaScript when the browser resizes. Example You can try running the following code to check the browser window size using events −<!DOCTYPEhtml><html> <head> <script>&am

Tesla sends out Robotaxi invitations for October 10 autonomous driving demo event in LA Tesla sends out Robotaxi invitations for October 10 autonomous driving demo event in LA Sep 27, 2024 am 06:20 AM

It was initially expected that Tesla would unveil its previously leaked Robotaxi back in August of this year, but CEO Elon Musk postponed the event, citing aesthetic changes to the front of the robotaxi and additional time needed for a few last-minut

See all articles