Hi,
When I place the following code into a query I get a syntax error (syntax error missing operator in mgrwms_party.customer_no WHERE mgrwms_party.customer_no IN (SELECT T2.customer_no FROM mgrwms_party AS T2 GROUP BY T2.customer_no HAVING COUNT(T2.customer_no)=1)
code:
SELECT Left([mgrwms_object].[object_name],InStr([mgrwms_object].[object_name],"-")-1) AS ServicePoint, Mid([mgrwms_object].[object_name],InStr([mgrwms_object].[object_name],"-")+1) AS ServiceNo, mgrwms_object_authority.party_no AS PartyNo, mgrwms_party.customer_no AS CustomerNo, mgrwms_party.given_name AS GivenName, mgrwms_party.surname AS Surname, mgrwms_party.address_1, mgrwms_party.address_2, mgrwms_party.address_3, mgrwms_party.post_code, mgrwms_party.phone_no
FROM (mgrwms_node INNER JOIN (((mgrwms_object INNER JOIN mgrwms_object_authority ON mgrwms_object.object_no = mgrwms_object_authority.object_no) INNER JOIN mgrwms_object_type ON mgrwms_object.object_type = mgrwms_object_type.object_type) INNER JOIN mgrwms_party ON mgrwms_object_authority.party_no = mgrwms_party.party_no) ON mgrwms_node.node_object_no = mgrwms_object.object_no) INNER JOIN mgrwms_link_object ON mgrwms_node.link_object_no = mgrwms_link_object.object_no
GROUP BY mgrwms_object_authority.party_no, mgrwms_party.customer_no, mgrwms_party.given_name, mgrwms_party.surname, mgrwms_party.address_1, mgrwms_party.address_2, mgrwms_party.address_3, mgrwms_party.post_code, mgrwms_party.phone_no, mgrwms_object.object_name, mgrwms_link_object.link_object_no, mgrwms_object.object_type
HAVING (((mgrwms_link_object.link_object_no)=102978 Or (mgrwms_link_object.link_object_no)=102979 Or (mgrwms_link_object.link_object_no)=102980) AND ((mgrwms_object.object_type)=17))
ORDER BY Left([mgrwms_object].[object_name],InStr([mgrwms_object].[object_name],"-")-1), Mid([mgrwms_object].[object_name],InStr([mgrwms_object].[object_name],"-")+1), mgrwms_party.customer_no WHERE mgrwms_party.customer_no IN (SELECT T2.customer_no FROM mgrwms_party AS T2 GROUP BY T2.customer_no HAVING COUNT(T2.customer_no)=1);
The code works without the WHERE clause but I'm trying to get distinct customer.no
Can anyone spot the problem?
cheers
bob
When I place the following code into a query I get a syntax error (syntax error missing operator in mgrwms_party.customer_no WHERE mgrwms_party.customer_no IN (SELECT T2.customer_no FROM mgrwms_party AS T2 GROUP BY T2.customer_no HAVING COUNT(T2.customer_no)=1)

code:
SELECT Left([mgrwms_object].[object_name],InStr([mgrwms_object].[object_name],"-")-1) AS ServicePoint, Mid([mgrwms_object].[object_name],InStr([mgrwms_object].[object_name],"-")+1) AS ServiceNo, mgrwms_object_authority.party_no AS PartyNo, mgrwms_party.customer_no AS CustomerNo, mgrwms_party.given_name AS GivenName, mgrwms_party.surname AS Surname, mgrwms_party.address_1, mgrwms_party.address_2, mgrwms_party.address_3, mgrwms_party.post_code, mgrwms_party.phone_no
FROM (mgrwms_node INNER JOIN (((mgrwms_object INNER JOIN mgrwms_object_authority ON mgrwms_object.object_no = mgrwms_object_authority.object_no) INNER JOIN mgrwms_object_type ON mgrwms_object.object_type = mgrwms_object_type.object_type) INNER JOIN mgrwms_party ON mgrwms_object_authority.party_no = mgrwms_party.party_no) ON mgrwms_node.node_object_no = mgrwms_object.object_no) INNER JOIN mgrwms_link_object ON mgrwms_node.link_object_no = mgrwms_link_object.object_no
GROUP BY mgrwms_object_authority.party_no, mgrwms_party.customer_no, mgrwms_party.given_name, mgrwms_party.surname, mgrwms_party.address_1, mgrwms_party.address_2, mgrwms_party.address_3, mgrwms_party.post_code, mgrwms_party.phone_no, mgrwms_object.object_name, mgrwms_link_object.link_object_no, mgrwms_object.object_type
HAVING (((mgrwms_link_object.link_object_no)=102978 Or (mgrwms_link_object.link_object_no)=102979 Or (mgrwms_link_object.link_object_no)=102980) AND ((mgrwms_object.object_type)=17))
ORDER BY Left([mgrwms_object].[object_name],InStr([mgrwms_object].[object_name],"-")-1), Mid([mgrwms_object].[object_name],InStr([mgrwms_object].[object_name],"-")+1), mgrwms_party.customer_no WHERE mgrwms_party.customer_no IN (SELECT T2.customer_no FROM mgrwms_party AS T2 GROUP BY T2.customer_no HAVING COUNT(T2.customer_no)=1);
The code works without the WHERE clause but I'm trying to get distinct customer.no
Can anyone spot the problem?
cheers
bob