Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
metroix
Starting Member
16 Posts |
Posted - 2008-07-11 : 16:19:33
|
i have a game ranking and i want to make a number 1 playerfor that i need to select the first row of my ranking this is the query of the ranking$query=mysql_query("SELECT * FROM characters where gm = 0 ORDER BY level DESC, exp DESC LIMIT $start, $upp",$con); |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-07-11 : 16:32:26
|
This looks like MySql. You should post your question on a MySql forum such as the one over at dbforums(.com). SQLTeam is for Microsoft SQL Server.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-12 : 05:27:16
|
quote: Originally posted by metroix i have a game ranking and i want to make a number 1 playerfor that i need to select the first row of my ranking this is the query of the ranking$query=mysql_query("SELECT * FROM characters where gm = 0 ORDER BY level DESC, exp DESC LIMIT $start, $upp",$con);
Do you have any problem with that query?Do you want to convert that to SQL Server specific query?As said, if you use mysql, then post at mysql forums like www.mysql.comMadhivananFailing to plan is Planning to fail |
 |
|
DURGESH
Posting Yak Master
105 Posts |
Posted - 2008-07-12 : 06:16:35
|
declare @sql varchar(2000),@ctr intset @ctr=1set @sql='select top'+@ctr+' * from tablname'exec(@sql) |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-07-12 : 06:20:29
|
quote: Originally posted by DURGESH declare @sql varchar(2000),@ctr intset @ctr=1set @sql='select top'+@ctr+' * from tablname'exec(@sql)
Dont use Dynamic sqldeclare @sql varchar(2000),@ctr intset @ctr=1Set Rowcount @ctrselect * from tablname order by somecolset rowcount 0MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|