このMySQLクエリがあります
SELECT count( * ) AS total
FROM `orders` o, `orders_status` s, `orders_status_history` osh
LEFT JOIN `orders_total` ot ON ot.orders_id = o.orders_id
WHERE o.orders_status = s.orders_status_id
AND osh.orders_id = o.orders_id
AND s.language_id = '5'
AND s.orders_status_id = '6'
AND ot.class = 'ot_total'
このエラーが発生します:
#1054 - Unknown column 'o.orders_id' in 'on clause'
私のテーブルスキーマは次のとおりです。
CREATE TABLE IF NOT EXISTS `orders` (
`orders_id` int(11) NOT NULL auto_increment,
`customers_id` int(11) NOT NULL default '0',
`last_modified` datetime default NULL,
`orders_status` int(5) NOT NULL default '0',
`orders_date_finished` datetime default NULL,
`comments` text,
`currency` char(3) default NULL,
`currency_value` decimal(14,6) default NULL,
`invoice_number` varchar(100) default NULL,
PRIMARY KEY (`orders_id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=8419 ;
そして、エラーがどこから来たのか理解できません。何か案は?