I have several fields in multiple tables that have the same name so I have to use alias's. I have changed the code so many times and keep getting errors either from the alias's, the grouping or the key fields.
This is the latest code:
The error message says "The column bl_id was specified multiple times for rmpctsum." This is the message I got after adding "bl.bl_id" to the select statement because the message before that was "Multi-part identified bl.bl_id could not be bound in this code" so I thought it needed the bl.bl_id to bind the rmpctsum.bl_id and bl.bl_id together and bind the 2 tables.
I can't figure out what I am doing wrong since this works in SQL 2005 but not on the website.
This is the latest code:
Code:
SELECT rmpctsum.bl_id, rmpctsum.dv_id, bl.bl_id, bl.bl_id_old, bl.name AS bldg_name, bl.address1, bl.own_or_ls, bl.campus, bl.area_usable, bl.area_chargable, bl.fmw_active, bl.city_id, city.city_id AS city_city_id, city.name AS city_name, dv.dv_id AS dv_dv_id, dv.name AS dept_name
FROM rmpctsum, bl, city, dv
WHERE rmpctsum.bl_id IS NOT NULL AND rmpctsum.dv_id IS NOT NULL AND rmpctsum.bl_id = bl.bl_id AND bl.city_id = city.city_id AND rmpctsum.dv_id = dv.dv_id AND bl.fmw_active = 1
GROUP BY rmpctsum.bl_id, rmpctsum.dv_id, bl.bl_id, bl.bl_id_old, bl.name, bl.address1, bl.own_or_ls, bl.campus, bl.area_usable, bl.area_chargable, bl.fmw_active, bl.city_id, city.city_id, city.name, dv.dv_id, dv.name
The error message says "The column bl_id was specified multiple times for rmpctsum." This is the message I got after adding "bl.bl_id" to the select statement because the message before that was "Multi-part identified bl.bl_id could not be bound in this code" so I thought it needed the bl.bl_id to bind the rmpctsum.bl_id and bl.bl_id together and bind the 2 tables.
I can't figure out what I am doing wrong since this works in SQL 2005 but not on the website.