|
发表于 2008-2-21 06:25:36
|
显示全部楼层
|阅读模式
来自 中国–内蒙古–锡林郭勒盟–锡林浩特市
如何实现,让MYSQL中score这列从大到小排序,并且找出比已知变量g_score大的行数g_ranknum,然后g_ranknum+1就是CS的排名了.这段代码怎么写,高手帮帮忙.
g_dbc = dbi_connect(g_host,g_user,g_pass,g_dbname,g_error,MAX_NAME_LENGTH);
result = dbi_query(g_dbc,"select * from `%s` where Username = '%s'", g_sqlstats_table, g_name);
dbi_result(result, "score",g_score,10)
dbi_free_result(result)
dbi_close(g_dbc)
result = dbi_query(g_dbc,"SELECT COUNT(*) AS %s FROM `%s` WHERE score > g_score ", g_sqlstats_table, g_name);
我这样试了不成功啊 |
|