ndevriendt
Programmer
Hello,
In SQL there is an UNION instruction where it is
possible to combine two queries with the same
record structure, and make a sort on the result
of this combination.
Is this also possible in a logical file ?
I haven the following query
select donrdo,patndo,udnrud as avwdo,dbdtud as dbdt, dbhrud as dbhr,
dedtud as dedt, dehrud as dehr
from burgud join bdosdo on donrdo = donrud
where patndo = 80850
union
select donrdo,patndo,sdnrsd as avwdo,dbdtsd as dbdt, dbhrsd as dbhr,
dedtsd as dedt, dehrsd as dehr
from bsocsd join bdosdo on donrdo = donrsd
where patndo = 80850
order by dbdt desc, dbhr desc
When I run this query, I've the result I want to have,
and that's all the records from table BURGUD and BSOCSD
together being sorted on DBDT and DBHR
I've tried to make an logical file as following
A R BURGUDR1 PFILE(BURGUD)
A DLKDUD
A DONRUD
A PATNUD
A UDNRUD
A DBDTUD
A DBHRUD
A DEDTUD
A DEHRUD
A K DBDTUD
A K DBHRUD
A R BSOCSDR1 PFILE(BSOCSD)
A DLKDSD
A DONRSD
A PATNSD
A SDNRSD
A DBDTSD
A DBHRSD
A DEDTSD
A DEHRSD
A K DBDTSD
A K DBHRSD
The problem here is that I can not say select * from logicalfilename
because he's telling me that there is more than one classification, and
I suppose that the records being sorted seperately on the two tables
and not at the combination of the two tables.
Thanks for your time and answer
Devriendt Nico
In SQL there is an UNION instruction where it is
possible to combine two queries with the same
record structure, and make a sort on the result
of this combination.
Is this also possible in a logical file ?
I haven the following query
select donrdo,patndo,udnrud as avwdo,dbdtud as dbdt, dbhrud as dbhr,
dedtud as dedt, dehrud as dehr
from burgud join bdosdo on donrdo = donrud
where patndo = 80850
union
select donrdo,patndo,sdnrsd as avwdo,dbdtsd as dbdt, dbhrsd as dbhr,
dedtsd as dedt, dehrsd as dehr
from bsocsd join bdosdo on donrdo = donrsd
where patndo = 80850
order by dbdt desc, dbhr desc
When I run this query, I've the result I want to have,
and that's all the records from table BURGUD and BSOCSD
together being sorted on DBDT and DBHR
I've tried to make an logical file as following
A R BURGUDR1 PFILE(BURGUD)
A DLKDUD
A DONRUD
A PATNUD
A UDNRUD
A DBDTUD
A DBHRUD
A DEDTUD
A DEHRUD
A K DBDTUD
A K DBHRUD
A R BSOCSDR1 PFILE(BSOCSD)
A DLKDSD
A DONRSD
A PATNSD
A SDNRSD
A DBDTSD
A DBHRSD
A DEDTSD
A DEHRSD
A K DBDTSD
A K DBHRSD
The problem here is that I can not say select * from logicalfilename
because he's telling me that there is more than one classification, and
I suppose that the records being sorted seperately on the two tables
and not at the combination of the two tables.
Thanks for your time and answer
Devriendt Nico