![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Jun 2005
Location: Amittyville
Posts: 60
Rep Power: 4
![]() |
getting a mysql entry that has a cell that ends with...
Is there a way to check if a cell in mysql ends with a certain string something like:
$sql = "delete from table where name endsWith 'hn'";
__________________
I steal hippos... |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Jun 2005
Location: Amittyville
Posts: 60
Rep Power: 4
![]() |
nvm I figured it out
here: $sql = "delete from examples where right(name, 2) = 'hn'
__________________
I steal hippos... |
|
|
|
|
|
#3 |
|
Professional Programmer
|
Good piece of code, I was going to suggest using php to select all where it would contain hn, run through each one, do a substring on it, check, if it checks out delete it. Your method is much nicer, I guess I gotta brush up on my SQL a bit
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() ![]() |
for an alternative, you may also be able to do something like this:
$sql = "delete from table where name like '%hn'";
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|