Subject | Re: [firebird-support] How does one opress a result in a result table, not to appear more than ones? |
---|---|
Author | unordained |
Post date | 2010-09-02T14:30:09Z |
---------- Original Message -----------
From: "phfranzos" <phfranzos@...>
try something like:
execute block returns (first_name varchar(50), name varchar(50), sex varchar
(10), car varchar(30)) as
declare variable r_first_name varchar(50);
declare variable r_name varchar(50);
declare variable r_sex varchar(30);
declare variable r_car varchar(30);
declare variable same_person integer;
begin
for select first_name, name, sex, car from some_table
into :first_name, :name, :sex, :car do
begin
same_person = case when first_name = r_first_name and name = r_name then 1
else 0;
r_first_name = first_name;
r_name = name;
r_sex = sex;
r_car = car;
if (same_person = 1) then
begin
first_name = null;
name = null;
sex = null;
end
suspend;
end
end
From: "phfranzos" <phfranzos@...>
> but I want it should rather look like follows:------- End of Original Message -------
>
> FIRST NAME NAME SEX CAR
> Joe Miller male Buick
> Ford
> BMW
> Chrysler
> Monica Smith female Ford
> Cadillac
> Chevrolet
> Toyota
> Dodge
> Jack Teller male Jeep
> Pontiac
> Ford
try something like:
execute block returns (first_name varchar(50), name varchar(50), sex varchar
(10), car varchar(30)) as
declare variable r_first_name varchar(50);
declare variable r_name varchar(50);
declare variable r_sex varchar(30);
declare variable r_car varchar(30);
declare variable same_person integer;
begin
for select first_name, name, sex, car from some_table
into :first_name, :name, :sex, :car do
begin
same_person = case when first_name = r_first_name and name = r_name then 1
else 0;
r_first_name = first_name;
r_name = name;
r_sex = sex;
r_car = car;
if (same_person = 1) then
begin
first_name = null;
name = null;
sex = null;
end
suspend;
end
end