Jump to content

bubblegum.anarchy

Members
  • Posts

    526
  • Joined

  • Last visited

    Never

Posts posted by bubblegum.anarchy

  1. um.. I don't know, how about replace ENGINE with TYPE.

     

    EDIT: FYI - the above create query works perfectly fine via SQLyog

     

    and also try removing the backticks from the KEY column names:

    KEY `group_id` (group_id),

    KEY `forum_id` (forum_id)

  2. This was extremely tough:

     

    SELECT games.division, games.user, sum(games.payout) 
    FROM games
         INNER JOIN (
              SELECT substring_index(group_concat(pkey ORDER BY games.division, games.user, games.payout DESC), ',', 3) AS top_three_pkey
              FROM games
              GROUP BY games.division, games.user
              ORDER BY games.division, games.user, games.payout
         ) AS top_three ON find_in_set(games.pkey, top_three_pkey)
    GROUP BY games.division, games.user
    

  3. $count_query = mysql_query('SELECT COUNT(*) FROM table');
    $getcount = mysql_fetch_row($count_query);
    $count = $getcount['0'];
    
    vs.
    
    $count_query = mysql_query('SELECT * FROM table');
    $count = mysql_num_rows($count_query);
    

     

    One record is loaded into memory vs all the records loaded into memory

     

    $query = mysql_query('SELECT * FROM table');
    if (!$query) die(mysql_error());
    
    vs.
    
    $query = mysql_query('SELECT * FROM table') or die(mysql_error())
    

     

    not a great deal or difference - readability mostly.

  4. Probably one of the best aspects of MySQL procedures is the ability to move all the common database abstraction done in php (or whatever language) back to the more appropriate location of MySQL.  So instead of a php file that contains a common function to return account details, the same function can be defined in a procedure and used simply in php or any other language base.

  5. So I am putting the condition like t1.fld_name = <some_val> and this does not match with any row. If I am having count(t1.field1), it shall get count "0" for that row, but it is not generating result for that row.

    Why are you expecting a result if you are getting a zero row count ?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.