hi,

I am trying to replace certain strings in my mysql database.

I have addresses such as this:

60 W 23rd St, New York 10010 Btwn 5th & 6th Ave

I would like to get rid off all the words starting from New York including the comma before the word "New York". The output should be this

60 W 23rd St

I have other address that are similar like this. They all start with the street address. Just like the example above.

What do I have to do to make this happen ?

I would appreciate for any help on this

thanks

Recommended Answers

All 2 Replies

Try this update table1 set address=left(address,(locate(',',address) -1))

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.