Subject | RE: [firebird-support] How can I combine these two queries into one? |
---|---|
Author | Anthony Tanas |
Post date | 2007-01-09T03:04:41Z |
Yep that was it! But what's the difference between UNION and UNION ALL?
W. Anthony Tanas
Systems Analyst/Architect/Programmer
-------------------------------------------
Liquid Software Designs, Inc.
1300 Maynard Rd.
Ste. 102
Cary, NC 27511
-------------------------------------------
Phone: 919.244.3276
Fax: 866.394.5961
Email: anthony@...
Web: http://www.liquidsoftwaredesigns.com
<http://www.liquidsoftwaredesigns.com/>
-------------------------------------------
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Alexandre Benson
Smith
Sent: Monday, January 08, 2007 9:59 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] How can I combine these two queries into
one?
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
[Non-text portions of this message have been removed]
W. Anthony Tanas
Systems Analyst/Architect/Programmer
-------------------------------------------
Liquid Software Designs, Inc.
1300 Maynard Rd.
Ste. 102
Cary, NC 27511
-------------------------------------------
Phone: 919.244.3276
Fax: 866.394.5961
Email: anthony@...
Web: http://www.liquidsoftwaredesigns.com
<http://www.liquidsoftwaredesigns.com/>
-------------------------------------------
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Alexandre Benson
Smith
Sent: Monday, January 08, 2007 9:59 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] How can I combine these two queries into
one?
Anthony Tanas wrote:
> 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
[Non-text portions of this message have been removed]