PDA

View Full Version : Query for deleting templates which have a prefix "X"


geniuscrew
02-17-2003, 11:05 PM
is it possible to do this? thanks

N!ck
02-17-2003, 11:30 PM
i know you can do instr(), such as:

DELETE FROM table WHERE INSTR(field, 'string')

don't hold me to that, i might have the parameters backwards.

anyhow, check out the manual at http://www.mysql.com/

Xenon
02-17-2003, 11:36 PM
hmm i think this one:

DELETE FROM template WHERE template LIKE (prefix%)

but not 100% sure, use it on your own risk ;)

N!ck
02-18-2003, 02:10 AM
i'm going to go out on a limb and say that Xenon is definitely correct...try it on a test table first though.

filburt1
02-18-2003, 02:38 AM
I think you need quotes...or if you don't you probably should anyway:

DELETE FROM template WHERE template LIKE "prefix%"

For example:

mysql> select userid,username from user where username like "filburt%";
+--------+----------+
| userid | username |
+--------+----------+
| 1 | filburt1 |
+--------+----------+
1 row in set (0.00 sec)

Xenon
02-18-2003, 10:17 AM
yes filburt is right, quotes are needed

geniuscrew
02-18-2003, 07:03 PM
Ahh OK - thanks everyone!

geniuscrew
02-18-2003, 07:10 PM
Query with quotes don't work ppl

Xenon
02-18-2003, 07:11 PM
use singelquotes :)

geniuscrew
02-18-2003, 07:20 PM
Still not working :( - it says the query is a success though

Xenon
02-18-2003, 07:31 PM
sorry, my fault, change the "template like" into "title like" ^^

geniuscrew
02-22-2003, 08:21 PM
Oh thankyou - Xenon

Again :P

Xenon
02-23-2003, 10:10 AM
welcome :)

gmarik
05-17-2003, 08:22 PM
Thanks, Fil.