<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: SQL Highscore Table Database</title>
	<atom:link href="http://turborilla.com/development/database-tips-n-trix/feed/" rel="self" type="application/rss+xml" />
	<link>http://turborilla.com/development/database-tips-n-trix/</link>
	<description></description>
	<lastBuildDate>Wed, 04 Jan 2012 17:16:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Brett Unzaga</title>
		<link>http://turborilla.com/development/database-tips-n-trix/comment-page-1/#comment-842</link>
		<dc:creator>Brett Unzaga</dc:creator>
		<pubDate>Sat, 19 Jun 2010 03:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://turborilla.com/?p=444#comment-842</guid>
		<description>&quot;Do you know how you can improve the performance?&quot;  To me, the biggest drawback is you are using the &#039;score&#039; table three times.  First you query all the games where the user has a score(as total).  Second you query all the games again(as my_scores).  Third, you query all the games again(as other_scores).

Please keep in mind, I haven&#039;t used inner join before, so I don&#039;t know the details around that command.

To me it should go like this:  $user_games = all games where user = 1.  You now have all the games where the user has a score, no need to query it for the second part.  Next part, do $lost = SELECT game FROM $user_games WHERE user.score !=(SELECT MAX(score) from $user_games).

So basically, for each game in user_games, get the games where the user.score is not the max.  I have to admit, I just looked up &#039;mysql get highest value&#039; in google, so the syntax might not be right, but you get the idea.  Query the database once, then use that for the future steps.</description>
		<content:encoded><![CDATA[<p>&#8220;Do you know how you can improve the performance?&#8221;  To me, the biggest drawback is you are using the &#8216;score&#8217; table three times.  First you query all the games where the user has a score(as total).  Second you query all the games again(as my_scores).  Third, you query all the games again(as other_scores).</p>
<p>Please keep in mind, I haven&#8217;t used inner join before, so I don&#8217;t know the details around that command.</p>
<p>To me it should go like this:  $user_games = all games where user = 1.  You now have all the games where the user has a score, no need to query it for the second part.  Next part, do $lost = SELECT game FROM $user_games WHERE user.score !=(SELECT MAX(score) from $user_games).</p>
<p>So basically, for each game in user_games, get the games where the user.score is not the max.  I have to admit, I just looked up &#8216;mysql get highest value&#8217; in google, so the syntax might not be right, but you get the idea.  Query the database once, then use that for the future steps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brett Unzaga</title>
		<link>http://turborilla.com/development/database-tips-n-trix/comment-page-1/#comment-841</link>
		<dc:creator>Brett Unzaga</dc:creator>
		<pubDate>Sat, 19 Jun 2010 03:04:07 +0000</pubDate>
		<guid isPermaLink="false">http://turborilla.com/?p=444#comment-841</guid>
		<description>&quot;Do you see what would happen if two players have the same score?&quot;

It looks like the players first in the list would be placed above the players that come after him.

The first part is fairly straight forward.  Get all the games where the player = 1 as a number.

The second part was a bit confusing for me, as I have never used &#039;inner join&#039; before.  But I think the logic is...  for all the games where I have a score, get all the other peoples scores which are also the same game.  Check my score vs their score, and if mine is lower, return that game.

Then you subtract total - lost.  I don&#039;t see any code to handle what to do if one players (total-lost) == another players (total-lost), so it leads me to believe that it will just go in order from first to last.  Whoever runs the query first will be at the top, whoever runs the query last will be on the bottom, assuming their numbers are the same...

So in the above example.  player1 would be first, player2 would be second and player 3 would be third because player1= 2-1, player2 = 2-1, player3 = 1-1</description>
		<content:encoded><![CDATA[<p>&#8220;Do you see what would happen if two players have the same score?&#8221;</p>
<p>It looks like the players first in the list would be placed above the players that come after him.</p>
<p>The first part is fairly straight forward.  Get all the games where the player = 1 as a number.</p>
<p>The second part was a bit confusing for me, as I have never used &#8216;inner join&#8217; before.  But I think the logic is&#8230;  for all the games where I have a score, get all the other peoples scores which are also the same game.  Check my score vs their score, and if mine is lower, return that game.</p>
<p>Then you subtract total &#8211; lost.  I don&#8217;t see any code to handle what to do if one players (total-lost) == another players (total-lost), so it leads me to believe that it will just go in order from first to last.  Whoever runs the query first will be at the top, whoever runs the query last will be on the bottom, assuming their numbers are the same&#8230;</p>
<p>So in the above example.  player1 would be first, player2 would be second and player 3 would be third because player1= 2-1, player2 = 2-1, player3 = 1-1</p>
]]></content:encoded>
	</item>
</channel>
</rss>

