MySQL Forums
Forum List  »  MySQL Query Browser

Need to start a string in a particular place if a condition is met
Posted by: Charles Swain
Date: July 26, 2012 09:20AM

The table I am using stores changes in account activity. I am running a report where I am tracking 4 different types of changes. One of the types is a really long string and I am trying to condense it. I am using

select `company`, `type`, `account id`,
IF (`type` like 'changed quantity%', right(`information`,30), `information)
from `customers`;

The problem is, the string I am using RIGHT() on is not consistent because the string begins with '%user% saved account info....blah blah...changing quantity from 25 to 30', and due to different quantities having different lengths, the return looks very sloppy and some things are getting cut off.

Is there a function to make the string always begin at 'changing quantity from..'?



Edited 1 time(s). Last edit at 07/26/2012 09:21AM by Charles Swain.

Options: ReplyQuote


Subject
Written By
Posted
Need to start a string in a particular place if a condition is met
July 26, 2012 09:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.