有一个积分表,积分从高往下排,如何取出其中的一个用户的排名,积分
sql语句是
select a.username,(@rowNum:=@rowNum+1) as c,a.integral as 积分from xs_user a,(Select (@rowNum :=0 ) ) b order by integral DESC,time
我如何在这条sql语句的基础上,查询出用户的用户名,积分。
或者如何在php中获取一下?
回复讨论(解决方案)
知道用户名么, 直接select 用户名,积分 from table where 用户名=用户名不就完事了么
??出表??。
SELECT * FORM ( select a.username,(@rowNum:=@rowNum+1) as c,a.integral as 积分 from xs_user a,(Select (@rowNum :=0 ) ) b order by integral DESC,time ) T WHERE username='XXX'
这种定义用户变量的写法还是很巧妙的
SELECT * FORM ( select a.username,(@rowNum:=@rowNum+1) as c,a.integral as 积分 from xs_user a,(Select (@rowNum :=0 ) ) b order by integral DESC,time ) T WHERE username='XXX'
这种定义用户变量的写法还是很巧妙的
SELECT * From ( select a.username,(@rowNum:=@rowNum+1) as c,a.integral as 积分 from xs_user a,(Select (@rowNum :=0 ) ) b order by integral DESC,time ) T WHERE username=18511337033'
这么写 ,加上where条件就会报错,没有where条件 就正常。
下面这是错误信息。
[SQL] SELECT * From ( select a.username,(@rowNum:=@rowNum+1) as c,a.integral as 积分 from xs_user a,(Select (@rowNum :=0 ) ) b order by integral DESC,time ) T WHERE username=18511337033'[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 6
这是表结构
SELECT * FORM ( select a.username,(@rowNum:=@rowNum+1) as c,a.integral as 积分 from xs_user a,(Select (@rowNum :=0 ) ) b order by integral DESC,time ) T WHERE username='XXX'
这种定义用户变量的写法还是很巧妙的
我看错了。。是我的自己的问题。。 sorry。。 3Q 谢谢了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



QQ Music is a player software with many types of music. You can search here for any type of music you want to listen to. The sound quality of all the music is very good and there are many different sound quality options. So do you know how to collect points on QQ Music? Detailed tutorial on how to collect points on QQ Music: 1. First open the [QQ Music] APP software and click the [My] function button in the bottom function bar. 2. Then click the [Activity Center] function button. 3. Then click the [Receive Points] button to receive the points. Software introduction: 1. High-quality music playback; 2. Album pictures and full-screen lyrics display; 3. Log in to QQ to synchronize my favorite songs on QQ Music on the computer; 4. Massive online

How to redeem Tmall points? In the software Tmall, we will get corresponding points every time we make a purchase. Some users want to know how to redeem items on Tmall. It can be redeemed in Tmall points in the member center. Next is the editor’s introduction to the points redemption method for users. Interested users should come and take a look! How to redeem Tmall points? Answer: Redeem details in Tmall points in the member center: 1. Enter Taobao and click [My Taobao] on the lower right. 2. Click to enter [Member Center]. 3. You can see your [Tmall Points] and click to enter. 4. You can see the exchange items. Select the desired item to [Exchange]. 5. Use Tmall points to redeem.

Where can I check Alipay member points? Alipay APP can accumulate a lot of points, but most friends don’t know how Alipay members check their points. Next is the graphic tutorial on how to check Alipay member points brought by the editor. , interested users come and take a look! Tutorial on using Alipay. Where to find Alipay member points? 1. First open the Alipay APP and go to the [My] area in the lower right corner of the main page; 2. Then in the My area, click on the [Alipay Member] service function;

After shopping in Tmall, you will get Tmall points. Some friends want to check the number of their Tmall points but can't find where to check it. Let me introduce you to the operation method below. After opening the Tmall App on your mobile phone, click "I" in the lower right corner of the page to enter the personal center page, and then click the gear-shaped "Settings" icon in the upper right corner to open the setting options. 2. After coming to the settings page, click on the "Personal Information" item to enter. 3. Next, find "Member Level" on the page you enter, and click the current level displayed behind it to enter. 4. There is a "Tmall Points" under the orange card on the member center page. It shows how many Tmall points you currently have. Click to enter and you can view the relevant information about the points earned.

How to use Railway 12306 app to redeem train tickets with points? Railway 12306 app is a very smart software that can facilitate people's lives. It is very convenient and fast to buy tickets with this software. Everyone prefers to use this software to buy tickets, because you can also get some points by using this software to buy tickets, and users can use these points to redeem train tickets. Many users don’t know how to use points to redeem train tickets. The editor below has compiled methods for using points to redeem train tickets for your reference. How to redeem railway 12306 app points for train tickets: 1. Open the railway 12306 app on your mobile phone, select the place and time to take the train and click "Check Tickets". 2. The ticket in question

Telecom points earned from daily use of mobile phones can be used to redeem phone bills for deduction. Some users are still unclear about how to redeem telecom points for phone bills. They can choose points to recharge phone bills in the points exchange in the telecom business hall. Next, the editor It provides users with an introduction to how to redeem points for phone calls. Interested users can come and take a look! How to redeem telecom points for phone bills? Answer: Select points to recharge phone bills in the points redemption in the telecom business hall. Details: 1. Enter the software telecom business hall, and then click [Points Redemption] below. 2. Enter the page and click [I can redeem]. 3. Select [Recharge points to charge phone bills]. 4. After entering the points used, obtain the verification code and confirm it.

How to quickly earn points on the Xueqiangguo app? Xuexueqiangguo is a very easy-to-use software. Not only can you see the latest current affairs, but you can also learn a lot of knowledge. The amount of knowledge covered in this software is very rich, and we can also do questions online here. Then you will find that you can sometimes get points in this software. When you get certain points, you can redeem them for corresponding gifts. So what should you do to get points quickly? The editor of this site will give you below. We have sorted out ways to get points quickly. Learn how to quickly earn points on the Qiangguo app 1. After registering and entering the home page, you can click the "My" button in the lower right corner to enter another page. 2. After entering this page, click on the screen

Many friends are curious about how to check their points usage in Alipay software. The following is a brief introduction to the viewing method. Friends who are interested can learn about it together. After opening the "Alipay" application on your mobile phone, click "My" in the lower right corner to enter the personal page, and then select "Alipay Member" to enter the member area. 2. After coming to the Alipay membership interface, click on the entrance of "Personal Center" behind the personal avatar to open it. 3. Next, there is a "Points" in the personal center page. After seeing it, click on it to enter. 4. Finally enter the points details page, where you will see how many points you currently have left. Click to switch on the tab below to view the points details under the corresponding option.
