views:

43

answers:

2

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.

+1  A: 

You should check that the schemas match as well.

Does business_division have an id column on the Windows system?

I assume the database names (e.g. lc_vc_cg_353) also match.

I cannot see anything obvious in the syntax.

Phil Wallach
A: 

I fixed this by installing MySQL v4.1.22 on the Windows machine.

Fulvio