SELECT tbl238.FIO1_Name, tbl238.FIO1_ID,tbl239.FIO1_Name, tbl239.FIO1_ID,tbl240.FIO1_Name, tbl240.FIO1_ID,tbl241.FIO1_Name, tbl241.FIO1_ID,tbl242.FIO1_Name, tbl242.FIO1_ID,tbl243.FIO1_Name, tbl243.FIO1_ID,tbl244.FIO1_Name, tbl244.FIO1_ID,tbl245.FIO1_Name, tbl245.FIO1_ID,tbl246.FIO1_Name, tbl246.FIO1_ID,a.An1,a.Nazv,a.Izd,a.Mesto_p,a.Publ,a.Date, DATE_FORMAT(a.Date,'%Y'), DATE_FORMAT(a.Date,'%m'), DATE_FORMAT(a.Date,'%d'), DATE_FORMAT(a.Date,'%H'), DATE_FORMAT(a.Date,'%i'), DATE_FORMAT(a.Date,'%s'),a.Nn,a.Str,tbl290.Publ1_Name, tbl290.Publ1_ID,a.Doclad,a.TextPub,a.Description,a.Keywords,a.Url,a.Message_ID, a.User_ID, a.IP, a.UserAgent, a.LastUser_ID, a.LastIP, a.LastUserAgent, a.Priority,a.Checked, a.Created, a.LastUpdated FROM Message41 AS a ,Message37 AS c LEFT JOIN Classificator_FIO1 AS tbl238 ON a.A1=tbl238.FIO1_ID LEFT JOIN Classificator_FIO1 AS tbl239 ON a.A2=tbl239.FIO1_ID LEFT JOIN Classificator_FIO1 AS tbl240 ON a.A3=tbl240.FIO1_ID LEFT JOIN Classificator_FIO1 AS tbl241 ON a.A4=tbl241.FIO1_ID LEFT JOIN Classificator_FIO1 AS tbl242 ON a.A5=tbl242.FIO1_ID LEFT JOIN Classificator_FIO1 AS tbl243 ON a.A6=tbl243.FIO1_ID LEFT JOIN Classificator_FIO1 AS tbl244 ON a.A7=tbl244.FIO1_ID LEFT JOIN Classificator_FIO1 AS tbl245 ON a.A8=tbl245.FIO1_ID LEFT JOIN Classificator_FIO1 AS tbl246 ON a.A9=tbl246.FIO1_ID LEFT JOIN Classificator_Publ1 AS tbl290 ON a.Type=tbl290.Publ1_ID LEFT JOIN Subdivision AS sub ON sub.Subdivision_ID=a.Subdivision_ID LEFT JOIN Sub_Class AS cc ON cc.Sub_Class_ID=a.Sub_Class_ID WHERE 1=1 AND (c.Depart=12 AND ( a.A1=c.PIN||a.A2=c.PIN||a.A3=c.PIN||a.A4=c.PIN||a.A5=c.PIN|| a.A6=c.PIN||a.A7=c.PIN||a.A8=c.PIN||a.A9=c.PIN)) AND a.Checked=1 AND a.Message_ID=1108

Query failed (1054): Unknown column 'a.A1' in 'on clause'