Subject Re: [firebird-support] How can I combine these two queries into one?
Author Alexandre Benson Smith
Anthony Tanas wrote:
> SELECT DISTINCT
> TRANSACTIONSET.TRANSACTIONSETID,
> SUPERBILL.SUPERBILLID
> FROM
> SUPERBILL
> INNER JOIN SUPERBILLITEM ON (SUPERBILL.SUPERBILLID =
>
> SUPERBILLITEM.SUPERBILLID)
> INNER JOIN JOURNAL ON (SUPERBILLITEM.JOURNALID =
> JOURNAL.JOURNALID)
> INNER JOIN TRANSACTIONSET ON (JOURNAL.TRANSACTIONSETID =
> TRANSACTIONSET.TRANSACTIONSETID);
>
>
> SELECT DISTINCT
> TRANSACTIONSET.TRANSACTIONSETID,
> SUPERBILL.SUPERBILLID
> FROM
> SUPERBILL
> INNER JOIN SUPERBILLACTIVITY ON (SUPERBILL.SUPERBILLID =
> SUPERBILLACTIVITY.SUPERBILLID)
> INNER JOIN JOURNAL ON (SUPERBILLACTIVITY.JOURNALID =
> JOURNAL.JOURNALID)
> INNER JOIN TRANSACTIONSET ON (JOURNAL.TRANSACTIONSETID =
> TRANSACTIONSET.TRANSACTIONSETID);
>
> Thanks in advance,
>
> Anthony
>
>
>

What do you mean by combine ???


perhaps this ????

SELECT DISTINCT
TRANSACTIONSET.TRANSACTIONSETID,
SUPERBILL.SUPERBILLID
FROM
SUPERBILL
INNER JOIN SUPERBILLITEM ON (SUPERBILL.SUPERBILLID =

SUPERBILLITEM.SUPERBILLID)
INNER JOIN JOURNAL ON (SUPERBILLITEM.JOURNALID =
JOURNAL.JOURNALID)
INNER JOIN TRANSACTIONSET ON (JOURNAL.TRANSACTIONSETID =
TRANSACTIONSET.TRANSACTIONSETID)

union all

SELECT DISTINCT
TRANSACTIONSET.TRANSACTIONSETID,
SUPERBILL.SUPERBILLID
FROM
SUPERBILL
INNER JOIN SUPERBILLACTIVITY ON (SUPERBILL.SUPERBILLID =
SUPERBILLACTIVITY.SUPERBILLID)
INNER JOIN JOURNAL ON (SUPERBILLACTIVITY.JOURNALID =
JOURNAL.JOURNALID)
INNER JOIN TRANSACTIONSET ON (JOURNAL.TRANSACTIONSETID =
TRANSACTIONSET.TRANSACTIONSETID);



see you !

--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br