SQLTeam.com | Weblogs | Forums

I am getting the error message MSG102, Level 15 State 1, Line 16


#1

This is my select statement, I don't know what this error means: MSG102, Level 15 State 1, Line 16
SELECT
PCT_Product_Catalog.Product_Categorization_Tier_1,
PCT_Product_Catalog.Product_Categorization_Tier_2,
PCT_Product_Catalog.Product_Categorization_Tier_3,
PCT_Product_Catalog.Product_ID,
PCT_Product_Model_Version.Product_Name,
PCT_Product_Model_Version.Manufacturer,
count(distinct HPD_HELP_DESK.entry_id) ,
count(distinct BMC_CORE_BMC_BASEELEMENT.InstanceId) ,
Count(Distinct(CHG_INFRASTRUCTURE_CHANGE.Infrastructure_Change_ID)),
count(SRM_WOI_WORKORDER.InstanceId),
HPD_HELP_DESK.Closure_Product_Category_Tier1 ,
HPD_HELP_DESK.Closure_Product_Category_Tier2 ,
HPD_HELP_DESK.Closure_Product_Category_Tier3 ,
HPD_HELP_DESK.Closure_Product_Name ,
HPD_HELP_DESK.Closure_Manufacturer
FROM
(
SELECT HPD.* FROM HPD_HELP_DESK HPD
) HPD_HELP_DESK,
BMC_CORE_BMC_BASEELEMENT,
(
SELECT CIC.* FROM CHG_INFRASTRUCTURE_CHANGE CIC
WHERE EXISTS (
SELECT DISTINCT CTM1.COMPANY FROM CTM_PEOPLE_PERMISSION_GROUPS CTM1
WHERE --REMEDY_LOGIN_ID = @VARIABLE('BOUSER')
CTM1.COMPANY IS NOT NULL
AND ( CTM1.COMPANY=CIC.LOCATION_COMPANY
OR CTM1.COMPANY=CIC.COMPANY3
OR CTM1.COMPANY=CIC.ASCPY
OR CTM1.COMPANY=CIC.ChgImpCpy))
UNION
SELECT DISTINCT COMPANY
FROM ANA_UNRESTRICT_USER_VW URUSER
--WHERE URUSER.REMEDY_LOGIN_ID IS NOT NULL
CHG_INFRASTRUCTURE_CHANGE,
(
SELECT * FROM WOI_WorkOrder
) SRM_WOI_WORKORDER,
PCT_Product_Model_Version RIGHT OUTER JOIN PCT_Product_Catalog ON (PCT_Product_Catalog.Product_ID=PCT_Product_Model_Version.Product_ID)
GROUP BY
PCT_Product_Catalog.Product_Categorization_Tier_1,
PCT_Product_Catalog.Product_Categorization_Tier_2,
PCT_Product_Catalog.Product_Categorization_Tier_3,
PCT_Product_Catalog.Product_ID,
PCT_Product_Model_Version.Product_Name,
PCT_Product_Model_Version.Manufacturer,
HPD_HELP_DESK.Closure_Product_Category_Tier1 ,
HPD_HELP_DESK.Closure_Product_Category_Tier2 ,
HPD_HELP_DESK.Closure_Product_Category_Tier3 ,
HPD_HELP_DESK.Closure_Product_Name ,
HPD_HELP_DESK.Closure_Manufacturer


#2

You also get a text describing "Incorrect syntax near ....". Line 16 contains "HPD_HELP_DESK.Closure_Manufacturer" - does this field exists in table?
What strikes me the most is, that you don't join the tables by telling the compiler how the tables are "connected".
Also in the from sections, you "select * from ....". It had been enough to "just" mention the tablename (and alias).