Solved

sql mysql to search record that not begin with

Posted on 2010-11-24
3
330 Views
Last Modified: 2012-08-13
How can i search record that not be gin with  'abs' or  'cat' or  'f'a
0
Comment
Question by:teera
  • 2
3 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 250 total points
ID: 34210207
select * from tbl
where (not col like 'abs%' and not col like 'cat%' and not col like 'f''a%')

not sure if you deliberately meant f-dash-a
otherwise, the last part would be not col like 'f%'
0
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 34210208
select * from tbl
where (not col like 'abs%' and not col like 'cat%' and not col like 'f''a%')

not sure if you deliberately meant f-dash-a
otherwise, the last part would be not col like 'f%'
0
 
LVL 2

Assisted Solution

by:jingks03
jingks03 earned 250 total points
ID: 34210519
In addition, if you are familiar (or more comfortable) with regular expressions, you could always use something like

SELECT * from tbl WHERE col REGEXP '^(abs|cat|f''a)';
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySQL 5.6.30 - daily outages 46 60
Pivot tables in SQL 1 35
Duplicated data in GROUP_CONCAT 2 15
How efficient to move databases to Azure? 5 51
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question