I have a table of names and addresses, which includes a postcode column. I want to strip the spaces from the postcodes and select any that match a particular pattern. I\'m tryin
You have to repeat your expression everywhere you want to use it:
SELECT Replace(Postcode, ' ', '') AS P FROM Contacts WHERE Replace(Postcode, ' ', '') LIKE 'NW101%'
or you can make it a subquery
select P from ( SELECT Replace(Postcode, ' ', '') AS P FROM Contacts ) t WHERE P LIKE 'NW101%'