Solved

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

Posted on 2015-02-23
3
38 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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 look for a specific file type in a local or remote server directory using PHP.

914 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now