1

I have an application that executes the following MySQL query:

         SELECT 402 AS user_id,
                p.id AS perm_id,
                p.name AS perm_name,
                lc.business_division_id,
                bd.name AS bd_name,
                bd.current_cycle, bd.current_moon,
                lc.name AS cycle_name,
                lc.milestone_date,
                lc.scorecard_date,
                bdm.name AS meta_name,
                bdm.value AS meta_value
           FROM lc_vc_cg_353.business_division bd,
                lc_vc_cg_353.business_division_meta bdm,
                lc_vc_cg_353.lunar_cycle lc
LEFT OUTER JOIN lc_vc_cg_353.permissions ps
                  ON ps.user_id = 402 AND ps.business_division_id = bd.id inner
           join lc_vc_central.permission p
                  ON ((ps.privilege_id IS NOT null AND p.id = ps.privilege_id)
                       OR
                      (ps.privilege_id IS NULL AND p.id = 1024))
          WHERE
                bd.active = 1
                  AND
                bdm.business_division_id = bd.id
                  AND
                lc.business_division_id = bd.id
                  AND
                lc.id = bd.current_cycle
       ORDER by bd.name asc;

The production server works fine and is running MySQL v4.1.22 (Redhat), however when I execute the same query on a Windows machine running MySQL v5.1.43-community it comes up with the following error:

ERROR 1054 (42S22): Unknown column 'bd.id' in 'on clause'

Any ideas on what the issue could be? Could it be that particular syntax has been deprecated in newer versions of MySQL?

Any help would be greatly appreciated.

4

2 回答 2

1

您还应该检查模式是否匹配。

business_division 在 Windows 系统上是否有 id 列?

我假设数据库名称(例如 lc_vc_cg_353)也匹配。

我在语法中看不到任何明显的东西。

于 2010-02-15T04:32:24.890 回答
0

我通过在 Windows 机器上安装 MySQL v4.1.22 解决了这个问题。

于 2010-03-17T05:43:04.967 回答