<div class="gmail_extra"><font face="arial, sans-serif">I don't generally prefix the database name unless I'm doing multi-database joins. Move your where logic up into the joins and delete it from the where clause.</font></div>
<div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px">FROM `vtiger_crmentity`</span></div><div class="gmail_extra">
<span style="font-family:arial,sans-serif;font-size:13px">INNER JOIN `vtiger_account` ON </span><span style="font-family:arial,sans-serif;font-size:13px">`vtiger_account`.`accountid` = `vtiger_crmentity`.`crmid`</span></div>
<div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px">INNER </span><span style="font-family:arial,sans-serif;font-size:13px">JOIN `vtiger_accountscf` ON </span><span style="font-family:arial,sans-serif;font-size:13px">`vtiger_accountscf`.`accountid` = </span><span style="font-family:arial,sans-serif;font-size:13px">`vtiger_account`.`accountid`</span></div>
<div class="gmail_extra"><span style="font-family:arial,sans-serif;font-size:13px">INNER JOIN `vtiger_invoice` ON `vtiger_invoice`.`accountid` = `vtiger_account`.`accountid`</span><br style="font-family:arial,sans-serif;font-size:13px">
<br><div class="gmail_quote">On Tue, Dec 18, 2012 at 10:17 AM, John Crisp <span dir="ltr"><<a href="mailto:john@reetspetit.net" target="_blank">john@reetspetit.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div id=":ic">FROM `crm`.`vtiger_crmentity` INNER JOIN `crm`.`vtiger_account` INNER<br>
JOIN `crm`.`vtiger_accountscf` INNER JOIN `crm`.`vtiger_invoice`<br></div></blockquote></div><br></div>