Created
January 26, 2010 01:58
-
-
Save anonymous/286461 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT fabric.CodFabric,fabric.Fabricante,fabric.Pais, | |
COUNT(distinct fabrics.CodJogo) as TotFab,COUNT(distinct publishs.CodJogo) as TotPub | |
FROM fabric | |
LEFT JOIN fabrics on fabric.CodFabric = fabrics.CodFabric | |
LEFT JOIN publishs on fabric.CodFabric = publishs.CodFabric | |
GROUP BY fabric.CodFabric | |
EXPLAIN | |
1 SIMPLE fabric ALL NULL NULL NULL NULL 1078 Using temporary; Using filesort | |
1 SIMPLE fabrics index NULL PRIMARY 8 NULL 10801 Using index | |
1 SIMPLE publishs index NULL PRIMARY 8 NULL 2086 Using index | |
CREATE TABLE `fabric` (\n `CodFabric` int(11) NOT NULL default '0',\n `Fabricante` varchar(40) NOT NULL default '',\n `Pais` int(11) default NULL,\n `Imagem` longblob,\n `Descricao` mediumtext,\n PRIMARY KEY (`CodFabric`),\n KEY `Fabricante` (`Fabricante`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 | |
CREATE TABLE `fabrics` (\n `CodJogo` int(11) NOT NULL default '0',\n `CodFabric` int(11) NOT NULL default '0',\n PRIMARY KEY (`CodJogo`,`CodFabric`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 | |
CREATE TABLE `publishs` (\n `CodJogo` int(11) NOT NULL default '0',\n `CodFabric` int(11) NOT NULL default '0',\n PRIMARY KEY (`CodJogo`,`CodFabric`)\n) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment