$sql = "SELECT tax_type.*,
Chart1.account_name AS SalesAccountName,
Chart2.account_name AS PurchasingAccountName
- FROM ".TB_PREF."tax_types tax_type,"
- .TB_PREF."chart_master AS Chart1,"
- .TB_PREF."chart_master AS Chart2
- WHERE tax_type.sales_gl_code = Chart1.account_code
- AND tax_type.purchasing_gl_code = Chart2.account_code";
+ FROM ".TB_PREF."tax_types tax_type LEFT JOIN "
+ .TB_PREF."chart_master AS Chart1 ON tax_type.sales_gl_code = Chart1.account_code LEFT JOIN "
+ .TB_PREF."chart_master AS Chart2 ON tax_type.purchasing_gl_code = Chart2.account_code";
if (!$all) $sql .= " AND !tax_type.inactive";
return db_query($sql, "could not get all tax types");
$sql = "SELECT tax_type.*,
Chart1.account_name AS SalesAccountName,
Chart2.account_name AS PurchasingAccountName
- FROM ".TB_PREF."tax_types tax_type,"
- .TB_PREF."chart_master AS Chart1,"
- .TB_PREF."chart_master AS Chart2
- WHERE tax_type.sales_gl_code = Chart1.account_code
- AND tax_type.purchasing_gl_code = Chart2.account_code AND id=".db_escape($type_id);
+ FROM ".TB_PREF."tax_types tax_type LEFT JOIN "
+ .TB_PREF."chart_master AS Chart1 ON tax_type.sales_gl_code = Chart1.account_code LEFT JOIN "
+ .TB_PREF."chart_master AS Chart2 ON tax_type.purchasing_gl_code = Chart2.account_code
+ WHERE id=".db_escape($type_id);
$result = db_query($sql, "could not get tax type");
return db_fetch($result);