Subject | Re: [firebird-support] How can I combine these two queries into one? |
---|---|
Author | Alexandre Benson Smith |
Post date | 2007-01-09T02:58:58Z |
Anthony Tanas wrote:
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
> SELECT DISTINCTWhat do you mean by combine ???
> 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
>
>
>
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