mySQL guru?

Started by Tony W, April 16, 2010, 01:57:12 PM

Tony W

if your SQL is strong, I am not having any luck finding a query that will find and remove a string of characters.

if you're willing to take a crack at this, I'll give you a .txt file, the best explanation I can give of what needs to be done, and hopefully you can save me many many hours of manual editing.


recorder
Boss BR-800

recorder
Boss BR-80

recorder
Boss Micro BR

Oldrottenhead

is sql a lager? if so i can help you
whit goes oan in ma heid



Jemima's
Kite

The
Bunkbeds

Honker

Nevermet

Longhair
Tigers

Oldrottenhead
"In order to compose, all you need to do is remember a tune that nobody else has thought of."
- Robert Schumann

Oldrottenhead

computer lingo not beer, donner und blitzen
whit goes oan in ma heid



Jemima's
Kite

The
Bunkbeds

Honker

Nevermet

Longhair
Tigers

Oldrottenhead
"In order to compose, all you need to do is remember a tune that nobody else has thought of."
- Robert Schumann

Tony W

Quote from: oldrottenhead on April 16, 2010, 02:01:34 PMcomputer lingo not beer, donner und blitzen
Jim, I'd take help from you any other day than Friday at beer:30

but when I'm trying to write stuff that looks like this....

SELECT *
FROM `messages`
ORDER BY `messages`.`body` ASC
LIMIT 0 , 30


recorder
Boss BR-800

recorder
Boss BR-80

recorder
Boss Micro BR

Oldrottenhead

lmao i can order my beer in a few languages its something i take pride in but i cant order beer in basic or cobol i should be ashamed
whit goes oan in ma heid



Jemima's
Kite

The
Bunkbeds

Honker

Nevermet

Longhair
Tigers

Oldrottenhead
"In order to compose, all you need to do is remember a tune that nobody else has thought of."
- Robert Schumann

Tony W

SELECT *
FROM `Bar`
ORDER BY `ORH`.`body` ASC
Lager = Heavy  0 , 30


recorder
Boss BR-800

recorder
Boss BR-80

recorder
Boss Micro BR

Tony W

and yes, that's the nerdiest Joke I've ever written


recorder
Boss BR-800

recorder
Boss BR-80

recorder
Boss Micro BR

Oldrottenhead

lol  im going to the pub now, i'll tell that one lol. pray for me haha.
whit goes oan in ma heid



Jemima's
Kite

The
Bunkbeds

Honker

Nevermet

Longhair
Tigers

Oldrottenhead
"In order to compose, all you need to do is remember a tune that nobody else has thought of."
- Robert Schumann

Vanncad

Hey Tony,

I don't work with mySQL but maybe something along these lines:

mysql> SELECT INSERT('StringToSearch', INSTR('StringToSearch','StringToFind'), LENGTH('StringToFind'), 'StringToReplace');

For Example:
If your 'StringToSearch' was "SongCrafters"
If your 'StringToFind' was "Crafters"
If your 'StringToReplace' was "Writers"

This statement would find "Crafters" at the 5th position, it would then replace the number of characters in "Crafters" (i.e. #8) with the word "Writers"
You should end up with "SongWriters"
If you want to delete the characters, you should be able to just leave the "StringToReplace" as "" (i.e. blank)

There is also the REPLACE function:

mysql> SELECT REPLACE('StringToSearch','StringToFind','StringToReplace')

I think will do the same thing?


I use this kind of technique with VBA, but not with databases so I'm not sure if this is proper syntax (or if it will work).
It ain't pretty being easy.

Okay to Cover

Tony W

I'll see if I can get it to work Vann Thanks for the help!


recorder
Boss BR-800

recorder
Boss BR-80

recorder
Boss Micro BR