SQL Statement Problem.

Posted on 2008-10-21
Last Modified: 2012-05-05
Dear Expert,

I want to make a SQL statement to show the datas which is contain 'ab' but failed any one can help me?
Table Name: 123
Field Name: details

Select * from 123 where details LIKE '%ab%'

Am I correct ???
Question by:Rickyyy
  • 3
  • 2
  • 2
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 250 total points
ID: 22765625
this will work better:
sql server:
Select * from [123] where details LIKE '%ab%' 
ms access:
Select * from [123] where details LIKE '*ab*' 
Select * from `123` where details LIKE '%ab%' 
Select * from "123" where details LIKE '%ab%'

Open in new window


Author Comment

ID: 22765672
no record can found.....even have.....please help....
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22765721
please clarify what database type you have, and what syntax you used.
are you SURE you connect to the right db?
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

LVL 13

Expert Comment

ID: 22765735
What database are you using?  This may seem obvious but I've made this error.  Have you verified the column with '%ab%' in it is the 'details' column?

Author Comment

ID: 22769564
i am using Access (mdb). And I confirm there having %ab% in the details columns....
LVL 13

Expert Comment

ID: 22769689
Can you send the file?

Author Closing Comment

ID: 31508190
The statement is work. Problem found which is come from the database problem.

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How To Convert Date Stored as Varchar as an MSSQL DATE Type Field In a VIEW 3 26
MS SQL Server time between records 14 46
SQL Select in Access 2003 3 25
IIF in access query 19 24
As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 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