Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

left join

2 posts in Visual Basic Last posting was on 2004-11-01 23:30:13.0Z
f Posted on 2004-11-01 15:28:07.0Z
From: "f" <ff>
Newsgroups: advantage.visual_basic
Subject: left join
Date: Mon, 1 Nov 2004 10:28:07 -0500
Lines: 18
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 206.47.136.38
Message-ID: <418656b4@solutions.advantagedatabase.com>
X-Trace: 1 Nov 2004 08:31:00 -0700, 206.47.136.38
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!206.47.136.38
Xref: solutions.advantagedatabase.com Advantage.Visual_Basic:892
Article PK: 1137689

I am trying to create a select statment that will select all the rows in
vw_mod and only certain rows in vw_acc. Here is my select statement...

SELECT vw_mod.mod_key, vw_acc.acc_key, vw_acc.acc_vision,
vw_acc.acc_ajout, vw_acc.acc_modif, vw_acc.acc_suppr, vw_acc.acc_usager
FROM vw_mod
LEFT OUTER JOIN vw_acc
ON vw_mod.mod_key = vw_acc.acc_key
WHERE vw_acc.acc_usager = 'COWANB'
ORDER BY vw_mod.mod_key

The problem is that I am not getting all the rows from vw_mod... only the
ones that have an entry in vw_acc.

Thanks,
Brian


Mark Wilkins Posted on 2004-11-01 23:30:13.0Z
From: "Mark Wilkins" <mwilkins@extendsys.com>
Newsgroups: advantage.visual_basic
References: <418656b4@solutions.advantagedatabase.com>
Subject: Re: left join
Date: Mon, 1 Nov 2004 16:30:13 -0700
Lines: 31
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 198.102.102.86
Message-ID: <4186c77f@solutions.advantagedatabase.com>
X-Trace: 1 Nov 2004 16:32:15 -0700, 198.102.102.86
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!198.102.102.86
Xref: solutions.advantagedatabase.com Advantage.Visual_Basic:893
Article PK: 1137686

Hi Brian,

It is probably because of the "WHERE vw_acc.acc_usager='COWANB'" part of the
query. For the rows in vw_acc that do not have a matching acc_key, the
acc_usager value is, by definition, NULL (the row does not exist). Did you
maybe mean to include a field from vw_mod in the WHERE clause instead?

Mark Wilkins
Advantage R&D

"f" <ff> wrote in message news:418656b4@solutions.advantagedatabase.com...
>I am trying to create a select statment that will select all the rows in
>vw_mod and only certain rows in vw_acc. Here is my select statement...
>
> SELECT vw_mod.mod_key, vw_acc.acc_key, vw_acc.acc_vision,
> vw_acc.acc_ajout, vw_acc.acc_modif, vw_acc.acc_suppr, vw_acc.acc_usager
> FROM vw_mod
> LEFT OUTER JOIN vw_acc
> ON vw_mod.mod_key = vw_acc.acc_key
> WHERE vw_acc.acc_usager = 'COWANB'
> ORDER BY vw_mod.mod_key
>
> The problem is that I am not getting all the rows from vw_mod... only the
> ones that have an entry in vw_acc.
>
> Thanks,
> Brian
>