From what was provided the query should look like this
Code:
SELECT P2.voltage,V.voltage voltage2,count(*) AS KOL
FROM Lights_America..temp_products P2
LEFT JOIN voltage V ON (P2.voltage=V.id)
LEFT JOIN excludedproducts E ON (E.storeid=SessionID AND E.id=P2.id)
WHERE ??????????????????????
GROUP BY P2.voltage,V.voltage
ORDER BY voltage2
Looking at that I see on problem of two .. in this line
Code:
FROM Lights_America..temp_products P2
and then you also have a table named (supposedly) "voltage" and you are selecting a column named "voltage" ... Are you sure your table is named that? If so try putting [] around the column so these lines would change to
Code:
LEFT JOIN voltage V ON (P2.[voltage]=V.id)
GROUP BY P2.[voltage],V.[voltage]
but since your join is joining two totally different column names I am guessing you have miss-named the column... your foreign key should have the same name so it should look like
Code:
(P2.id=V.id)
-- or since you should call out the id's a little more detailed
P2.volt_id = V.volt_id
Doing as OldPedant will help though as well since we have no idea what strsql is until after whereStrSql is created