Jump to content
Sign in to follow this  
riz.pro

Select Statement And Wildcards

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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 !!!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...