0

i am using php/mysql.

i have a product table . in which most product have starting name with number.

i want to listout all products start with any number.

any one have idea about it....

Sanjay Khatri
  • 4,153
  • 7
  • 38
  • 42

2 Answers2

7

Ref this

SELECT * FROM product WHERE name REGEXP '^[0-9]'
Salil
  • 46,566
  • 21
  • 122
  • 156
-1

from what i understant, your product names are something like '123myproduct'. you should be able to search the table with

select * from product where name like '123%';

The LIKE construct uses '%' as a wildcard that means 'anything'

I hope this will help you

Jerome Wagner

Jerome WAGNER
  • 21,986
  • 8
  • 62
  • 77
  • 1
    from question "start with any number" it is clearhe want result which start with any number.your query fails if it start with any other than '123' – Salil Jun 10 '10 at 07:10