Note that there are some explanatory texts on larger screens.

plurals
  1. POfetching data from different tables based on different joins in single query
    primarykey
    data
    text
    <p>the query returns perfect results when <code>invstorelocation</code>.<code>Description</code> AS Location , is not included in the query along with the join</p> <pre><code> INNER JOIN `invstorelocation` ON (`invlabtes`.`StockLocCode` = `invstorelocation`.`Code`) </code></pre> <p>But when I include this join in the query the table returns empty even though all conditions are fully met. Plz mention the alternative to fetch Location record along with other records.</p> <pre><code> SELECT `invlabtes`.`CommAppCode` , `invlabtes`.`Code` , `invlabtes`.`GatePassNO` , `invlabtes`.`VehicleNo` , `invlabtes`.`SupplierCode` , `invstorelocation`.`Description` AS Location , `invstore`.`Description` AS MaterialName FROM `invlabtes` INNER JOIN `invstorelocation` ON (`invlabtes`.`StockLocCode` = `invstorelocation`.`Code`) INNER JOIN `invgatepass` ON (`invlabtes`.`GatePassNO` = `invgatepass`.`InwardNo`) AND (`invlabtes`.`GatePassDate` = `invgatepass`.`EntryDate`) AND (`invlabtes`.`VehicleNo` = `invgatepass`.`VehicleNo`) INNER JOIN `invgatepasssubtable` ON (`invlabtes`.`GatePassNO` = `invgatepasssubtable`.`InwardNo`) AND (`invlabtes`.`ItemCode` = `invgatepasssubtable`.`ItemCode`) INNER JOIN `invstore` ON (`invgatepass`.`StoreCode` = `invstore`.`Code`) WHERE (`invlabtes`.`Code` LIKE '%%' OR `invlabtes`.`CommAppCode` LIKE '%%' OR `invlabtes`.`GatePassNO` LIKE '%%' OR `invlabtes`.`VehicleNo` LIKE '%%' OR `invlabtes`.`SupplierCode` LIKE '%%') AND `invlabtes`.`CommAppCode`&lt;&gt;'' AND `invlabtes`.`Unit_Code`='1' LIMIT 100; </code></pre> <p>This query successfully returns the data. The above query has problem.</p> <pre><code> SELECT `invlabtes`.`CommAppCode` , `invlabtes`.`Code` , `invlabtes`.`GatePassNO` , `invlabtes`.`VehicleNo` , `invlabtes`.`SupplierCode` , `invstore`.`Description` AS MaterialName FROM `invlabtes` INNER JOIN `invgatepass` ON (`invlabtes`.`GatePassNO` = `invgatepass`.`InwardNo`) AND (`invlabtes`.`GatePassDate` = `invgatepass`.`EntryDate`) AND (`invlabtes`.`VehicleNo` = `invgatepass`.`VehicleNo`) INNER JOIN `invgatepasssubtable` ON (`invlabtes`.`GatePassNO` = `invgatepasssubtable`.`InwardNo`) AND (`invlabtes`.`ItemCode` = `invgatepasssubtable`.`ItemCode`) INNER JOIN `invstore` ON (`invgatepass`.`StoreCode` = `invstore`.`Code`) WHERE (`invlabtes`.`Code` LIKE '%%' OR `invlabtes`.`CommAppCode` LIKE '%%' OR `invlabtes`.`GatePassNO` LIKE '%%' OR `invlabtes`.`VehicleNo` LIKE '%%' OR `invlabtes`.`SupplierCode` LIKE '%%') AND `invlabtes`.`CommAppCode`&lt;&gt;'' AND `invlabtes`.`Unit_Code`='1' LIMIT 100; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload