Hi Guys, I have two columns in a "Customers" table: "Cust" and "Cust_Adr" which are the Customers Name and Customers Address. The postcode is included in the Address column and I want to extract the Postcode and then return results where the same postcode appears more than 5 times.
So I tried:
But no joy. I'm getting "Data Type Mismatch is Criteria Expression" Error.
Can anyone help with where I'm going wrong? Cheers
So I tried:
Code:
[COLOR=#333333][FONT=Segoe UI]SELECT c.Cust, c.Cust_ADR, [/FONT][/COLOR][COLOR=#333333][FONT=Segoe UI]Mid(Cust_adr,InStrRev(cust_adr,",")+1) AS Postcode[/FONT][/COLOR]
[COLOR=#333333][FONT=Segoe UI]FROM tbl_Customers AS c[/FONT][/COLOR]
[COLOR=#333333][FONT=Segoe UI]GROUP BY c.Cust, c.Cust_ADR, [/FONT][/COLOR][COLOR=#333333][FONT=Segoe UI]Mid(Cust_adr,InStrRev(cust_adr,",")+1)[/FONT][/COLOR]
[COLOR=#333333][FONT=Segoe UI]HAVING COUNT([/FONT][/COLOR][COLOR=#333333][FONT=Segoe UI]Mid(Cust_adr,InStrRev(cust_adr,",")+1)[/FONT][/COLOR][COLOR=#333333][FONT=Segoe UI]) >=5[/FONT][/COLOR]
But no joy. I'm getting "Data Type Mismatch is Criteria Expression" Error.
Can anyone help with where I'm going wrong? Cheers