Subject | Re: [ib-support] First function |
---|---|
Author | Louis van Alphen |
Post date | 2001-07-18T07:40:09Z |
At 14:33 2001-07-17 +0200, you wrote:
create procedure GET_ALL_RECORDS
returns(COLUMN_A TYPE,COLUMN_B TYPE,...)
as
begin
for select column_a,column_b from table
where expression
order by expression
into :COLUMN_A,:COLUMN_B
do
begin
suspend;
end
end
create procedure GET_FIRST_RECORD
returns(COLUMN_A TYPE,COLUMN_B TYPE,...)
as
begin
execute procedure GET_ALL_RECORDS
returning_values :column_a,:column_b
suspend;
end
If you now do a
SELECT * FROM GET_FIRST_RECORD
query, it will return the first record generated by the SELECT in the
GET_ALL_RECORDS procedure.
Hope it helps.....
L.J. van Alphen
>Hi Robert.You can do this by using a stored procedure:
>
> >Is there a way to pick the first record in a GROUP BY, like the First
> >function in access?
>
>No, unfortunately not. Maybe there is a UDF that can do it, but I generally
>don't use UDFs so others will have to answer that.
create procedure GET_ALL_RECORDS
returns(COLUMN_A TYPE,COLUMN_B TYPE,...)
as
begin
for select column_a,column_b from table
where expression
order by expression
into :COLUMN_A,:COLUMN_B
do
begin
suspend;
end
end
create procedure GET_FIRST_RECORD
returns(COLUMN_A TYPE,COLUMN_B TYPE,...)
as
begin
execute procedure GET_ALL_RECORDS
returning_values :column_a,:column_b
suspend;
end
If you now do a
SELECT * FROM GET_FIRST_RECORD
query, it will return the first record generated by the SELECT in the
GET_ALL_RECORDS procedure.
Hope it helps.....
L.J. van Alphen