riz.pro Posted July 1, 2009 Share Posted July 1, 2009 hi,i have table with a column (say name) with values as below--------------name--------------M04897M05678MSF00089MSF00111T167854T89732TB91SF_014TB92SF_112i want to select all the records excluding T167854 and T89732. ie where name = T followed by an integer.The below query doesn't workSELECT * FROM temp WHERE name='T[123456789]%';is there anything wrong with it? or How do i accomplish it?i m using MySql 5.1.31 Link to comment Share on other sites More sharing options...
justsomeguy Posted July 1, 2009 Share Posted July 1, 2009 Yes, there's something wrong with that query, you're telling it to select records where the name is the string "T[123456789]%". If you want to use a pattern you need to use a regex. Check the user comments on this page for several examples:http://dev.mysql.com/doc/refman/5.1/en/regexp.html Link to comment Share on other sites More sharing options...
riz.pro Posted July 3, 2009 Author Share Posted July 3, 2009 Yes, there's something wrong with that query, you're telling it to select records where the name is the string "T[123456789]%". If you want to use a pattern you need to use a regex. Check the user comments on this page for several examples:http://dev.mysql.com/doc/refman/5.1/en/regexp.html Thanks a lot ! thats exactly what i was looking for. Link to comment Share on other sites More sharing options...
uwspstar Posted July 16, 2009 Share Posted July 16, 2009 Yes, there's something wrong with that query, you're telling it to select records where the name is the string "T[123456789]%". If you want to use a pattern you need to use a regex. Check the user comments on this page for several examples:http://dev.mysql.com/doc/refman/5.1/en/regexp.html thanks for sharing , I add it into my bookmark !!! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.