Jump to content

[HELP] how do it


erisP

Recommended Posts

addEventHandler("onResourceStart", resourceRoot, function()
	dbQuery(toptime, db, "SELECT name, time FROM general ORDER BY time DESC LIMIT 20")
	dbQuery(topkill, db, "SELECT name, kills FROM general ORDER BY kills DESC LIMIT 20")
	dbQuery(topdrift, db, "SELECT name, drift FROM general ORDER BY drift DESC LIMIT 20")
	dbQuery(toprecord, db, "SELECT name, record FROM general ORDER BY record DESC LIMIT 20")
	dbQuery(toplvl, db2, "SELECT name, lvl FROM general2 ORDER BY lvl DESC LIMIT 20")
	dbQuery(topeff, db2, "SELECT name, eff FROM general2 ORDER BY eff DESC LIMIT 20")
end)

setTimer(function()
	dbQuery(toptime, db, "SELECT name, time FROM general ORDER BY time DESC LIMIT 20")
	dbQuery(topkill, db, "SELECT name, kills FROM general ORDER BY kills DESC LIMIT 20")
	dbQuery(topdrift, db, "SELECT name, drift FROM general ORDER BY drift DESC LIMIT 20")
	dbQuery(toprecord, db, "SELECT name, record FROM general ORDER BY record DESC LIMIT 20")
	dbQuery(toplvl, db2, "SELECT name, lvl FROM general2 ORDER BY lvl DESC LIMIT 20")
	dbQuery(topeff, db2, "SELECT name, eff FROM general2 ORDER BY eff DESC LIMIT 20")
end,600*1000,0)

 

I m trying to sort it Will I have any problems if I use it this way? or how can I do it better?

Link to comment
  • Moderators
18 hours ago, erisP said:

I m trying to sort it Will I have any problems if I use it this way? or how can I do it better?

This is fine.

 

You could transform it in 1 query. But that basically means that you will have to split them up later with Lua.

SELECT 
	name, 
	'time' AS type, 
	time, 
	NULL AS kills 
FROM general ORDER BY time DESC LIMIT 20

UNION ALL

SELECT 
	name, 
	'kills' AS type, 
	NULL AS time, 
	kills 
FROM general ORDER BY kills DESC LIMIT 20

 

 

 

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...