Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3301314
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:44:22+00:00 2026-05-17T20:44:22+00:00

How to retrieve the records those character star starting with A OR B OR

  • 0

How to retrieve the records those character star starting with A OR B OR C ,

I just tried this query

SELECT * FROM `test_tbl` WHERE Left(cus_name, 1) = 'a'

 ---> display all customer name starting with character a

AND I added one more condition, That is

SELECT * FROM `test_tbl` WHERE Left(cus_name, 1) = 'a' or Left(cus_name, 1) = 'b'

 --->It  displayed all customer name starting with character a and in some records middle i saw some name starting with b also, 

What i want is , i want pull out records , which names are starting with A or B or C ,

And also it should order by alphabetical order,

Also i tried this below query.

SELECT * FROM `test_tbl` WHERE Left(cus_name, 1) REGEXP '^[^a-z]+$';

The rendered records for that above is , just two records started with A,

This above question for doing the alphabetical pagination ,

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:44:22+00:00Added an answer on May 17, 2026 at 8:44 pm

    You can try:

    SELECT * FROM `test_tbl` WHERE cus_name REGEXP '^[abc]';
    

    It will list all rows where cus_name starts with either a, b or c.

    The regex used is ^[abc]:

    • ^ : Is the start anchor
    • [..] : Is the character class. So [abc] matches either an a or a b or a c. It is equivalent to (a|b|c)

    The regex you were using : ^[^a-z]+$

    • The first ^ is the start anchor.
    • [..] is character class.
    • The ^ inside the character class
      negates it. So [^abc] is any
      character other than the three
      listed.
    • + is the quantifier for one or
      more.
    • $ is the end anchor.

    So effectively you are saying: give me all the rows where cus_name contains one or more letters which cannot be any of the lowercase letters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making this method retrieve records from the Data Base. As you can see
I'm trying to retrieve records from table by knowing the date in column contains
What is the best way to retrieve records from the database? Currently we are
I want to retrieve all records from one table when there are no matches
I want to retrieve the records from a table without its associations mentioned in
Is there any methods to retrieve deleted records from a mysql database?
I have a query below that I use to retrieve the records not updated
I have below order table,i want to retrieve records those are not in order
I am using Rails 3.2.2 and I would like to retrieve records from the
I have to retrieve the more than 100 records from the Database table using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.