Hi,
How about ordering by Address_type ? only needs to have 1, 2, 3 as
different address types in your desired order. like :
select person_id , address where address in not null order by address_type
limit 1 ;
sure you can change the limit if you wish more addresses.
hope that helps
Omid Omo
"omid omoomi" <[EMAIL PROTECTED]> writes:
> Hi,
> How about ordering by Address_type ? only needs to have 1, 2, 3 as
> different address types in your desired order. like :
>
> select person_id , address where address in not null order by address_type
> limit 1 ;
>
> sure you can change the
Prasanth A. Kumar writes:
> I need some suggestions on how to construct a particular select that I
> need. I have a table of addresses where the primary key is the
> persons_id and a address_type field. The address_type field is a
> character which specifies whether the address is for the home, w
Is there some fast way to get the count of rows in a cursor?
FETCH count(*) FROM mycursor; -- expresses what I want
I know I could always just do a SELECT count(*) in a separate query, but I'm
asking in case a cursor has this information already and I just don't know how
to get it.
--
I have table with the following definition:
create table table1(
account_no int4,
start_date_tme datetime
);
The table may contain null values for start_date_time.
When I run the following SQL query, it fails:
s
At 12:07 17/07/00 +1000, Carolyn Lu Wong wrote:
>I have table with the following definition:
>
> create table table1(
> account_no int4,
> start_date_tme datetime
>
> );
>
>The table may contain null values for start_date_time.
>
>Wh
Philip Warner wrote:
>
> At 12:07 17/07/00 +1000, Carolyn Lu Wong wrote:
> >I have table with the following definition:
> >
> > create table table1(
> > account_no int4,
> > start_date_tme datetime
> >
> > );
> >
> >The table may
At 13:41 17/07/00 +1000, Carolyn Lu Wong wrote:
>> Try
>> select count(*) from table1 where account_no = 1 and start_date_time is
>> null;
>>
>> and see if you get 0.
>
>Yes, i get 0 from running the above query, but it fails if i re-arrange
>the where clause to:
>
> select * from table
Philip Warner <[EMAIL PROTECTED]> writes:
> Another alternative would be to define a 'coalesce' function (I don't think
> PG has one), which takes an arbitrary number of arguments and returns the
> first non-null one.
We surely do have that! It even works pretty well in 7.0 ;-)
(I think there we
> The immediate cause of this gripe was discussed just a day or so ago
> on one or another of the pgsql lists. The timestamp-to-date conversion
> routine has this weird idea that it should kick out an error instead
> of returning NULL when presented with a NULL timestamp. That's a bug
> IMHO, an
At 02:26 17/07/00 -0400, Tom Lane wrote:
>
>Well before my time, I guess --- as long as I've been paying attention,
>the function manager's approach was to call the routine first and *then*
>insert a NULL result ... if the routine hadn't crashed first. That's
>about as braindead a choice as I can
11 matches
Mail list logo