Обсуждение: Select statement question

Поиск
Список
Период
Сортировка

Select statement question

От
"ebp"
Дата:
Im trying to select only the first names from a table that begin with an A.
I tryed this:
select fname,lname,subscriber_id from kbeg where fname='A*'||'a*'
and no rows shows up, im positive that there are atleast 1,000 rows with fname starting with A.
Any suggestions?
 

Re: Select statement question

От
Doug Silver
Дата:
On Sat, 2 Mar 2002, ebp wrote:

> Im trying to select only the first names from a table that begin with an A.
> I tryed this:
> select fname,lname,subscriber_id from kbeg where fname='A*'||'a*'
> and no rows shows up, im positive that there are atleast 1,000 rows with fname starting with A.
> Any suggestions?
>
>

How about something like this

select fname,lname,subscriber_id from kbeg where fname~*'^a';

~ is for regular expression, * is case insensitive, and ^ means at the
beginning of fname.

Look at Chapter 4.10 in Bruce Momjian's "PostgreSQL" for more examples.


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doug Silver
Network Manager
Quantified Systems, Inc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Re: Select statement question

От
denis@coralindia.com
Дата:
 
TRy
 
select fname,lname,subscriber_id from kbeg where substr(fname,1,1) ='A'
 
Hope this helps
 
Denis
 
----- Original Message -----
From: ebp
Sent: Sunday, March 03, 2002 3:43 AM
Subject: [NOVICE] Select statement question

Im trying to select only the first names from a table that begin with an A.
I tryed this:
select fname,lname,subscriber_id from kbeg where fname='A*'||'a*'
and no rows shows up, im positive that there are atleast 1,000 rows with fname starting with A.
Any suggestions?