Subject | Cascade Select in Firebird |
---|---|
Author | h4o |
Post date | 2004-03-31T07:39:41Z |
Hello everybody,
How can I use cascade select in firebird without view?
What I mean by cascade select is like:
select *
from (select * from ... where ...)
where ...
If I'm not wrong, it works on Oracle.
Currently I'm using view as workaround like in this case:
First I'm create a view:
create view myview (invoice_no, total) as
select header_invoice.invoice_no, sum(detail_invoice.subtotal)
as total
from header_invoice join detail_invoice on
header_invoice.invoice_no = detail_invoice.invoice_no;
Then I need to display invoice which total is more than 100:
select *
from myview
where myview.total >= 100;
Is it possible to display the results in just one SQL statement?
I hope it could be something like this:
select *
from
(select header_invoice.invoice_no, sum
(detail_invoice.subtotal) as total
from header_invoice join detail_invoice on
header_invoice.invoice_no = detail_invoice.invoice_no)
where total >= 100;
I need to solve the problem cause in some case using view giving me
a very slow performance.
Sorry if my question is OOT.
Anyway thanks a lot before
---
hao
How can I use cascade select in firebird without view?
What I mean by cascade select is like:
select *
from (select * from ... where ...)
where ...
If I'm not wrong, it works on Oracle.
Currently I'm using view as workaround like in this case:
First I'm create a view:
create view myview (invoice_no, total) as
select header_invoice.invoice_no, sum(detail_invoice.subtotal)
as total
from header_invoice join detail_invoice on
header_invoice.invoice_no = detail_invoice.invoice_no;
Then I need to display invoice which total is more than 100:
select *
from myview
where myview.total >= 100;
Is it possible to display the results in just one SQL statement?
I hope it could be something like this:
select *
from
(select header_invoice.invoice_no, sum
(detail_invoice.subtotal) as total
from header_invoice join detail_invoice on
header_invoice.invoice_no = detail_invoice.invoice_no)
where total >= 100;
I need to solve the problem cause in some case using view giving me
a very slow performance.
Sorry if my question is OOT.
Anyway thanks a lot before
---
hao