Jump to content

Select Statement And Wildcards


riz.pro

Recommended Posts

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

  • 2 weeks later...
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...