title: MySQL Query enter in a loop
body: <p>I have this MySQL query and the syntax is correct, but when I want to see the view, the mysql process go to 100%.</p>
  
  <pre><code>CREATE OR REPLACE VIEW tx_oriconvenios_consultas AS
          SELECT conv.*, tipo.descripcion AS tipo_convenio, uni.nombre AS n_universidad, ciu.nombre AS n_ciudad, pais.cn_short_es AS n_pais, COUNT(hist.estado) AS n_estado
          FROM tx_unalori_convenio AS conv
          LEFT JOIN tx_unalori_historico as hist
          ON conv.uid = hist.convenio
          INNER JOIN tx_unalori_tipoconv as tipo
          ON conv.tipoconv = tipo.uid
          INNER JOIN tx_unalori_universidad as uni
          ON conv.universidad = uni.uid
          INNER JOIN tx_unalori_ciudad as ciu
          ON ciu.uid=uni.uid_ciudad
          INNER JOIN static_countries as pais
          ON pais.cn_iso_3 = ciu.pais
          GROUP BY conv.uid
  </code></pre>
  
  <p>If I remove:</p>
  
  <pre><code>INNER JOIN static_countries as pais
          ON pais.cn_iso_3 = ciu.pais
  </code></pre>
  
  <p>or:</p>
  
  <pre><code> LEFT JOIN tx_unalori_historico as hist
      ON conv.uid = hist.convenio
  </code></pre>
  
  <p>Then I can enter to the view and see the registers.</p>
  
  <p>I can't understand why.</p>
  
  <p>I really apreciate some explanation.</p>
  
  <hr>
  
  <p>For those who asked, this is the structure of static_countries:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `static_countries` (
    `uid` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `pid` int(11) unsigned DEFAULT '0',
    `deleted` tinyint(4) NOT NULL DEFAULT '0',
    `cn_iso_2` char(2) DEFAULT '',
    `cn_iso_3` char(3) DEFAULT '',
    `cn_iso_nr` int(11) unsigned DEFAULT '0',
    `cn_parent_tr_iso_nr` int(11) unsigned DEFAULT '0',
    `cn_official_name_local` varchar(128) DEFAULT '',
    `cn_official_name_en` varchar(128) DEFAULT '',
    `cn_capital` varchar(45) DEFAULT '',
    `cn_tldomain` char(2) DEFAULT '',
    `cn_currency_iso_3` char(3) DEFAULT '',
    `cn_currency_iso_nr` int(10) unsigned DEFAULT '0',
    `cn_phone` int(10) unsigned DEFAULT '0',
    `cn_eu_member` tinyint(3) unsigned DEFAULT '0',
    `cn_address_format` tinyint(3) unsigned DEFAULT '0',
    `cn_zone_flag` tinyint(4) DEFAULT '0',
    `cn_short_local` varchar(70) DEFAULT '',
    `cn_short_en` varchar(50) DEFAULT '',
    `cn_uno_member` tinyint(3) unsigned DEFAULT '0',
    `cn_short_es` varchar(50) NOT NULL DEFAULT '',
    PRIMARY KEY (`uid`),
    UNIQUE KEY `uid` (`uid`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=250 ;
  </code></pre>
  
  <p>And this of the tx_unalori_historico:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `tx_unalori_historico` (
    `uid` int(11) NOT NULL AUTO_INCREMENT,
    `pid` int(11) NOT NULL DEFAULT '0',
    `tstamp` int(11) NOT NULL DEFAULT '0',
    `crdate` int(11) NOT NULL DEFAULT '0',
    `cruser_id` int(11) NOT NULL DEFAULT '0',
    `deleted` tinyint(4) NOT NULL DEFAULT '0',
    `hidden` tinyint(4) NOT NULL DEFAULT '0',
    `be_users` int(11) NOT NULL DEFAULT '0',
    `convenio` int(11) NOT NULL DEFAULT '0',
    `estado` int(11) NOT NULL DEFAULT '0',
    `observaciones` text NOT NULL,
    PRIMARY KEY (`uid`),
    KEY `parent` (`pid`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3810 ;
  </code></pre>