以下查询在 localhost 上运行良好并返回行,但在服务器中执行时返回错误...
显示的错误是
#1054 - Unknown column 'hc.id' in 'on clause'
什么问题?
select
hd.holiday_id,h.same_date, h.holiday, hd.date
from holiday_dates as hd
join holidays as h on hd.holiday_id=hc.id
join holiday_countries as hc on hc.holiday_id=h.id and hc.country_id=c.id
join countries as c
where
c.name='india' and hd.year='2010'
我的表结构是 国家
'id', 'int(11)', '', 'PRI', '', 'auto_increment'
'name', 'varchar(80)', 'YES', '', '', ''
假期
'id', 'int(11)', '', 'PRI', '', 'auto_increment'
'holiday', 'varchar(90)', 'YES', '', '', ''
'same_date', 'tinyint(1)', 'YES', '', '', ''
'religions', 'varchar(50)', '', '', '', ''
'season', 'enum('Winter','Spring','Summer','Autumn')', '', '', 'Winter', ''
'rate', 'int(2)', '', '', '0', ''
假日国家
'id', 'int(11)', '', 'PRI', '', 'auto_increment'
'holiday_id', 'int(11)', '', '', '0', ''
'country_id', 'int(11)', '', '', '0', ''
'link', 'varchar(40)', '', '', '', ''
假期日期
'holiday_id', 'int(11)', 'YES', 'MUL', '', '' // this refers to the holiday_id from holiday_countries table
'year', 'varchar(4)', 'YES', '', '', ''
'date', 'date', '', '', '0000-00-00', ''