Solved

How can I retrieve rows beginning with either a "#" or a number?

Posted on 2015-02-23
3
42 Views
Last Modified: 2015-02-23
I've got a table consisting of several hundred rows, all of them having a "term" column that can be easily sorted alphabetically with exception of 50 rows that have a term that starts with either a number or a "#" symbol.

How can I retrieve  just those rows that start with a number or the # sign?

Here's an example of the kind of data I'm talking about:

911 Surcharge
3DES
#BAL

What do you think?
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:justaphase
ID: 40626004
Define your colletion records?
From MySQL, MsSQL a PHP Array?
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 40626178
If it's MySQL, then this'll do it:

SELECT column1, column2 FROM yourTable WHERE term REGEXP '^[0-9#]+';

Open in new window

0
 

Author Comment

by:brucegust
ID: 40626569
Perfect, Chris!

Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

752 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