Commercial Brands

I am re-writing an old BAQ I wrote for product groups my customers do not buy. And due to our current way of using the Product groups, I was forced to use the Brands in the attributes in Part MAint.

Waht I ahve done is the follwoing (Thisis the 5th differnt configuration I have tried):

[Part1].[PartNum] as [Part1_PartNum]
from Erp.Part as Part1
where Part1.CommercialBrand = ANY (select Part_CommercialBrand from ((select
[InvcDtl].[CustNum] as [InvcDtl_CustNum],
[Part].[CommercialBrand] as [Part_CommercialBrand]
from Erp.InvcDtl as InvcDtl
inner join Erp.Part as Part on
Part.Company = InvcDtl.Company
Part.PartNum = InvcDtl.PartNum
and ( Part.CommercialBrand <> ‘’ )

where (InvcDtl.ShipDate >= DATEADD (year, -3, GETDATE()))
group by [InvcDtl].[CustNum],
[Part].[CommercialBrand])) as Part Brands)

When I restrict the Sub Criteria is gives me the error of Incorrect Syntax near ‘Brands’ Any ideas why I am getting this error? I’ve tried everything I can think of.

Maybe the space between “Part” and “Brands” in the GroupBy statement :

group by [InvcDtl].[CustNum], [Part].[CommercialBrand] ) ) as Part Brands

Try :

group by [InvcDtl].[CustNum], [Part].[CommercialBrand] ) ) as PartBrands

Ken Brunelli


Change the last line to [Part].[CommercialBrand])) as [Part Brands])

the brackets are needed since you have a space in the name



Except, it won’t let me change it. LOL! That’s my luck right there.

Is this in the BAQ Designer. If so you have to change the name of the subquery from Part Brands to PartBrands remove the space. I wish it would just let us modify the SQL.

1 Like