Subject Re: complex select
Author Aage Johansen
"duilio_fos " wrote:
> ...
> Going back to my SELECT, some parts of the code could well be written
> as different SPs, but I cannot use SPs in a SELECT, can I ?

I think you can (at least in some ways).


> Is there a way to take a complex SELECT and make it shorter and
> clearer ?

You could change to explicit join syntax, and qualify the field name in the
GROUP BY.

select distinct A.mat, A.nome
from tb_per A join tb_emq B on A.mat = B.mat
where A.turni_sn <> "N"
...
group by ?.prog


--
Aage J.