Perhaps someone can help me with this SQL - I have a database full of UK sales properties. Each property row has a column value set to the UK-formatted property postcode, eg:


To run a simlple partial postcode match such as a search for SW1 should find this example property the key SQL I have been using is:

(pr.ppostcode REGEXP '^SW1\[a-z\]' OR 
pr.ppostcode REGEXP '^SW1 ')
But the problem I now have is that the client wants the search to find a results set based on a list of multiple postcodes. So for example the list of multiple postcodes could be:

SW1,W1, W11,SW14

I need some fast SQL that will match the example SW1 4PJ property this example list of partial postcodes.

I can't use

(pr.ppostcode1 IN ('SW1','W1', 'W11','SW14'))
which would work if all the postcodes in the DB were split into 2 columns - postcodeA and postcodeB. They aren't so I have to make do with the DB I have. Any suggestions gratefully received :-)