Dear All
Many thanks for your valued feedback.
To try and explain myself, I have listed my current query as follows:
SELECT ACCOUNTS.ACCOUNTID, ACCOUNTS.NAME, CONTACTDETAILS.TELEPHONE,
ACCOUNTSBUDGET.TURNOVER
(I think the above is standard faire, but please let me know if it doesn't
make sense)
FROM ACCOUNTS, ACCOUNTSBUDGET, CONTACTDETAILS, PEOPLE
(ditto)
WHERE PEOPLE.PEOPLEID = ACCOUNTS.PEOPLEID AND CONTACTDETAILS.PEOPLEID =
PEOPLE.PEOPLEID AND ACCOUNTSBUDGET.ACCOUNTID = ACCOUNTS.ACCOUNTID AND
((ACCOUNTS.LEDGER=1) AND (ACCOUNTSBUDGET.YEAR=2002) AND
(ACCOUNTSBUDGET.PERIOD=6) AND (CONTACTDETAILS.SALESACCOUNTSCONTACT=1))
The 'ACCOUNTS.LEDGER=1' part simply filters customers from suppliers in the
ACCOUNTS table, ie customers = 1 and suppliers = 2.
The 'ACCOUNTSBUDGET.YEAR=2002' part is a Year filter, which I will make
variable later on so that I can let the user pick a specific year. I just
left it to 2002 to check that the query worked.
The 'ACCOUNTSBUDGET.PERIOD=6' part is a Month filter, which I will make
variable later on so that I can let the user pick a specific Month. I just
left it to 6 (which is June) to check that the query worked.
The 'CONTACTDETAILS.SALESACCOUNTSCONTACT=1' part simply filters account
contacts from other types in the CONTACTDETAILS table, ie
SALESACCOUNTSCONTACT=1 is a sales accounts contact and
SALESACCOUNTSCONTACT=0 isn't.
I want to list all of the ACCOUNTIDs and NAMEs in the ACCOUNTS table and
TELEPHONE in the CONTACTDETAILS where they either have a TURNOVER of zero in
the ACCOUNTSBUDGET table for the PERIOD and YEAR that the user specifies or
they don't have a value at all in the ACCOUNTSBUDGET table for the PERIOD
and YEAR that the user specifies, as this record 'no show' denotes that they
haven't any turnover either.
I'm sure its a join that I'm missing, as I'm trying to do 2 sorts of queries
in one - right, but I just can't get my head round how this is done.
Any ideas?
Rgds
Robbie
"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in
message news:%23vzJUQV7DHA.1592@TK2MSFTNGP10.phx.gbl...
Yes, but I recall some nasty bugs in 6.5, where you could get things like
"Network failure" etc when doing outer joins in 6.5 and the ANSI join
syntax. This was the first version that supported "ANSI joins". Perhaps the
majority of bugs were fixed in later service packs, but to some extent, I'm
happy that most programmers were still using the old join syntax in the 6.5
days. :-)
Or perhaps it was only a few special circumstances that I happened to run
into and I based my judgment on those...
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver [quoted text, click to view] "David Portas" <REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote in message
news:hYydnXsHDJ9uu7ndRVn-jA@giganews.com...
> 6.5 supports ANSI92 JOIN syntax. (I did actually have to look this up to
be
> sure)
>
> --
> David Portas
> SQL Server MVP
> --
>
>