Forums - C# Corner

Forum guidelines
Abraham Olatubosun

Abraham Olatubosun

  • 1.4k
  • 374
  • 22.5k

The use of LIKE in SQL Statement

Dec 5 2018 12:40 PM
Dear Code masters,
I hope this question meet you in good health, please all i have this issue around my sql script that i want you to assist.
I have records with the following data's
ID                         Age
AB1001                 20
AB1002                 21
ABI1001                25
ABI1002                28
AB1003                 30
AB1004                 32
ABI1003                26
ABI1004                10
I want to display all ABI ID's only using SQL Select Statement, I have tried the following:
  1. SELECT ID from TableID WHERE ID LIKE 'ABI%'  
Thi didn't give the expected output i also tried, it's display all the records
  1. SELECT ID from TableID WHERE ID NOT LIKE 'AB%'  
this too didn't give expected result it's display all the records
I need any sugestion that will display only record ID that start with ABI
Thank you

Answers (3)