Alternative to LIST aggregate function in Firebird

743 Views Asked by At

I have a a table Orders:

select * Orders order by 2

Ordernumber     Zone
12345           1
12345           2
12345           3

What sql would produce the following output?

Ordernumber     Zone
12345           123

Unfortunately, LIST cannot be used, since this is an old Firebird 1.5xxx. Are there any other possibilities?

1

There are 1 best solutions below

0
AudioBubble On
CREATE PROCEDURE GET_ZONER(ordernumber  Integer)
returns (zoner varchar(20))
AS
declare variable zone varchar(20) ;
Begin
  zoner = '';
  for 
  select distinct zone from orders 
  where ordernumber = :ordernumber order by zone into :zone  do
  begin
     zoner  =  zoner || :zone;
  end
  SUSPEND;
End

and then use

select * from getzoner(1234)