Вопрос

I would like to invert the text of certain records depending on if ValueA is greater than ValueB. If ValueA is indeed greater than ValueB, then I want to invert the contents of the field Content.

The image below shows the example table and the modifications I wish to make to that table.

http://imgur.com/st8CQ

NOTE:

  1. ValueA and ValueB are INTs

  2. The field Content is a data type TEXT

  3. The field Content can have in excess of 25,000 characters

Ive also considered exporting the entire database, and checking if ValueA is greater than ValueB, and if so, then when exporting that record, it would invert the text in the Content field...

EDIT:

I access MySQL through putty.

Это было полезно?

Решение

The function you are looking for is REVERSE(). You would need to write an update query to conditionally update the Content column.

UPDATE 
    YourTable
SET 
    Content = REVERSE(Content)
WHERE 
    ValueA > ValueB;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top