Hi, i don't know if i'm posting on the correct forum but this i thought was the most relevant forum.
i'm doing an sql query in our crm package to find clients with particular postcodes. An example of our postcodes are NW12 3RB, N1 2LW, SW12 3BW, etc. I only need the area part, so for the examples i would need NW, N, SW. I created a query below but i'm gettin errors:
SELECT contact1.Accountno, contact1.company, contact1.key4, contact2.uxdate, contact1.contact, contact1.zip
FROM contact1, contact2
WHERE (contact1.accountno=contact2.accountno)
AND (left(contact1.zip,(IF ISNUMERIC(contact1.zip,2) THEN 1 ELSE 2)) in ('NR','N'))
AND (contact1.key4 NOT IN ('EEF','CLA','FPI'))
AND (datepart(mm,contact2.uxdate) IN (08,09))
I get two server messages saying "The isnumeric funtion requires 1 arguments" and "Incorrect syntax near the keyword 'IF'"
Anybody out there that can help, or has a better way of just cutting the area out of the postcode for this query?
i'm doing an sql query in our crm package to find clients with particular postcodes. An example of our postcodes are NW12 3RB, N1 2LW, SW12 3BW, etc. I only need the area part, so for the examples i would need NW, N, SW. I created a query below but i'm gettin errors:
SELECT contact1.Accountno, contact1.company, contact1.key4, contact2.uxdate, contact1.contact, contact1.zip
FROM contact1, contact2
WHERE (contact1.accountno=contact2.accountno)
AND (left(contact1.zip,(IF ISNUMERIC(contact1.zip,2) THEN 1 ELSE 2)) in ('NR','N'))
AND (contact1.key4 NOT IN ('EEF','CLA','FPI'))
AND (datepart(mm,contact2.uxdate) IN (08,09))
I get two server messages saying "The isnumeric funtion requires 1 arguments" and "Incorrect syntax near the keyword 'IF'"
Anybody out there that can help, or has a better way of just cutting the area out of the postcode for this query?