s7BaT Posted July 1, 2016 Share Posted July 1, 2016 السلام عليك ابي كيف استخرج القيم من الاكبر للأصغر من عمود في قواعد البيانات اعرف استخرج القيم لكن ابيها تكون من الاكبر للأصغر ونفس الشي على الجداول زي توب الفلوس والتواجد وكنق الدرفت Link to comment
s7BaT Posted July 1, 2016 Author Share Posted July 1, 2016 table.sort ادري بس ما فهمت شف محاولتي وتراني ملخبط بام الكود local Query = executeSQLQuery("SELECT * FROM PointsDerby") if ( Query and type ( Query ) == "table" and #Query ~= 0 ) then table.sort(Query, function(a,b) return (tonumber(a.points)or 0) > (tonumber(b.points)or 0) end) for i,v in ipairs ( points ) do outputChatBox(v) end end ذا السطر جبته من موت توب درفت وعدلته table.sort(Query, function(a,b) return (tonumber(a.points)or 0) > (tonumber(b.points)or 0) end) اذا فيه تخويش والا شي عطني خبر عشن اباشر عملي Link to comment
s7BaT Posted July 1, 2016 Author Share Posted July 1, 2016 حط كود إنشاء الجدول حطيت بس ماطرحته Link to comment
s7BaT Posted July 1, 2016 Author Share Posted July 1, 2016 addEventHandler ( "onResourceStart", resourceRoot, function() executeSQLQuery ("CREATE TABLE IF NOT EXISTS PointsDerby (acc,points)") end) local Query = executeSQLQuery("SELECT * FROM PointsDerby") if ( Query and type ( Query ) == "table" and #Query ~= 0 ) then table.sort(Query, function(a,b) return (tonumber(a.points)or 0) > (tonumber(b.points)or 0) end) for i,v in ipairs ( points ) do outputChatBox(v) end end Link to comment
` Allawi Posted July 1, 2016 Share Posted July 1, 2016 (edited) local Query = executeSQLQuery("SELECT acc,points FROM PointsDerby") Edited July 1, 2016 by Guest Link to comment
فاّرس Posted July 1, 2016 Share Posted July 1, 2016 local Query = executeSQLQuery("SELECT * FROM PointsDerby") if ( Query and type ( Query ) == "table" and #Query ~= 0 ) then table.sort(Query, function(a,b) return (tonumber(a.points)or 0) > (tonumber(b.points)or 0) end) for i,v in ipairs ( Query ) do outputChatBox( v.acc .. ' : '.. v.points ) end end Link to comment
s7BaT Posted July 1, 2016 Author Share Posted July 1, 2016 local Query = executeSQLQuery("SELECT * FROM PointsDerby") if ( Query and type ( Query ) == "table" and #Query ~= 0 ) then table.sort(Query, function(a,b) return (tonumber(a.points)or 0) > (tonumber(b.points)or 0) end) for i,v in ipairs ( Query ) do outputChatBox( v.acc .. ' : '.. v.points ) end end ياعيني ياعيني شكرا يعني طريقتي كانت صح بس ناقصه Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now