lundi 20 avril 2015

I want to replace a string with another string from a list depending on the value

Let's say I have this string: '2015/4/21 (Tuesday)'.

I want to replace 'Tuesday' with another string, for example: cat.

The result should be: '2015/4/21 (cat)'.

But I also want it to be dynamic, if it's Tuesday, then cat. If it's Monday, then it's dog, etc.

How do I do this in PostgreSQL 8.4? Thanks!

There is a similar post: postgresql - replace all instances of a string within text field

But mine needs to replace something dynamic depending on the day and that post replaces a known value.

Aucun commentaire:

Enregistrer un commentaire