<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1016474" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1016474</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/searching-and-ordering-based-2-parts-mysql-database#comment-1095735</link>
    <description> &lt;p&gt;ORDER BY section ASC, percent DESC&lt;/p&gt;
&lt;p&gt;That should work.  section=1 is people with over 5 games.  section=0 is for people with under 5 games.  So this will sort by section first (5+ games at top), then percentage (highest percent at top).&lt;/p&gt;
 </description>
     <pubDate>Sat, 08 Dec 2001 00:03:18 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1095735 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/searching-and-ordering-based-2-parts-mysql-database#comment-1095721</link>
    <description> &lt;p&gt;That works great&lt;br /&gt;
But what if a user has less than 5 games?&lt;br /&gt;
I want those with less than 5 games still at the end, and ordered by their percent... Should I simply order it by percent DESC after that?? (I forgot, %s should be descending as the best percent is the highest &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt; )&lt;/p&gt;
 </description>
     <pubDate>Fri, 07 Dec 2001 21:30:59 +0000</pubDate>
 <dc:creator>nike_guy_man</dc:creator>
 <guid isPermaLink="false">comment 1095721 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/searching-and-ordering-based-2-parts-mysql-database#comment-1095676</link>
    <description> &lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;SELECT user, win, loss, percent, if((win+loss)&amp;gt;=5,1,0) as section&lt;br /&gt;FROM table_name&lt;br /&gt;ORDER BY section ASC, percent ASC&lt;/code&gt;&lt;/div&gt;&#039;In English: if the number of games is 5+, then &#039;section&#039; will be 1, else 0.  Then you sort on &#039;section&#039; first to get the 5+ games at the top, then sort on &#039;percent&#039; to get them ordered the way you want.&lt;/p&gt;
&lt;p&gt;mySQL Docs:&lt;br /&gt;
&lt;a href=&quot;http://www.mysql.com/doc/C/o/Control_flow_functions.html&quot; class=&quot;bb-url&quot;&gt;6.3.1.4 Control Flow Functions&lt;/a&gt; (info on IF statements)&lt;/p&gt;
 </description>
     <pubDate>Fri, 07 Dec 2001 06:18:16 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1095676 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/searching-and-ordering-based-2-parts-mysql-database#comment-1095669</link>
    <description> &lt;p&gt;Actually, now that that has been brought up, win columns and loss columns would make this a lot easier&lt;br /&gt;
Should I simply add the results of win column and loss column together and if thats &amp;gt; 5, then order by %s...&lt;br /&gt;
Great!&lt;br /&gt;
I&#039;ll try all this out, and come back when I make a stupid mistake!&lt;br /&gt;
This should be my sql query, correct?&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;$sql &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;SELECT user, win, loss, percent FROM &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$table&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; ORDER BY percent ASC \&quot;;&lt;br /&gt;mysql_query(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$sql&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
Then how do I parse that into tables? a while loop?&lt;/p&gt;
 </description>
     <pubDate>Fri, 07 Dec 2001 01:57:16 +0000</pubDate>
 <dc:creator>nike_guy_man</dc:creator>
 <guid isPermaLink="false">comment 1095669 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/searching-and-ordering-based-2-parts-mysql-database#comment-1095665</link>
    <description> &lt;p&gt;I would have had a win field and a loss field... if you could change that now, that would be best.&lt;/p&gt;
&lt;p&gt;If not, you could try something like this:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;SELECT *&lt;br /&gt;FROM table_name&lt;br /&gt;WHERE ( SUBSTRING_INDEX(record, &amp;#039;-&amp;#039;, 1) + SUBSTRING_INDEX(record, &amp;#039;-&amp;#039;, -1) ) &amp;gt;= 5&lt;br /&gt;ORDER BY percent ASC&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SELECT *&lt;br /&gt;FROM table_name&lt;br /&gt;WHERE ( SUBSTRING_INDEX(record, &amp;#039;-&amp;#039;, 1) + SUBSTRING_INDEX(record, &amp;#039;-&amp;#039;, -1) ) &amp;lt; 5&lt;br /&gt;ORDER BY percent ASC&lt;/code&gt;&lt;/div&gt;&#039;The first one should return people 5 games or over.  The second should return under 5 games.&lt;/p&gt;
 </description>
     <pubDate>Fri, 07 Dec 2001 00:09:54 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1095665 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/searching-and-ordering-based-2-parts-mysql-database#comment-1095649</link>
    <description> &lt;p&gt;OK...&lt;br /&gt;
user password email record percent&lt;br /&gt;
user1 password1 &lt;a href=&quot;mailto:user@random.net&quot; class=&quot;bb-email&quot;&gt;user@random.net&lt;/a&gt; 4-1 80&lt;br /&gt;
user2 passworda &lt;a href=&quot;mailto:user8@twf.com&quot; class=&quot;bb-email&quot;&gt;user8@twf.com&lt;/a&gt; 4-6 40&lt;br /&gt;
user3 pass &lt;a href=&quot;mailto:userpass@somewhere.net&quot; class=&quot;bb-email&quot;&gt;userpass@somewhere.net&lt;/a&gt; 3-0 100&lt;br /&gt;
user4 password &lt;a href=&quot;mailto:user4@thenga.com&quot; class=&quot;bb-email&quot;&gt;user4@thenga.com&lt;/a&gt; 6-0 100&lt;br /&gt;
user5 password &lt;a href=&quot;mailto:user5@thenga.com&quot; class=&quot;bb-email&quot;&gt;user5@thenga.com&lt;/a&gt; 1-2 67&lt;/p&gt;
&lt;p&gt;I want it to count the total of the split record column, and if that is more than 5, order it by the percent column&lt;br /&gt;
So it would be ranked&lt;br /&gt;
user4&lt;br /&gt;
user1&lt;br /&gt;
user2&lt;br /&gt;
user3&lt;br /&gt;
user5&lt;/p&gt;
&lt;p&gt;Even though user3 has a higher win percent, he hasn&#039;t competed 5 games so he doesn&#039;t qualify for the top position, unless no one else has any games played&lt;br /&gt;
Another thing, when I have users report that they lost, I want it to add 1 to the 2nd part of the record which I have split into the array $s so I want  it to add 1 to $s[1], and add 1 to the opponents first part of record, which is $x[0]&lt;br /&gt;
However, when I run the script, it adds 1 to both $s[0] $s[1] and $x[0] and $x[1]&lt;br /&gt;
Any idea?&lt;/p&gt;
 </description>
     <pubDate>Thu, 06 Dec 2001 21:05:48 +0000</pubDate>
 <dc:creator>nike_guy_man</dc:creator>
 <guid isPermaLink="false">comment 1095649 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/searching-and-ordering-based-2-parts-mysql-database#comment-1095602</link>
    <description> &lt;p&gt;I&#039;m a bit confused about that... can you make some mock data for us to see?&lt;/p&gt;
 </description>
     <pubDate>Thu, 06 Dec 2001 05:00:38 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1095602 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
