Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to understand the code...

Status
Not open for further replies.

tran008

Technical User
May 14, 2003
110
US
Hi all,

I'm trying to understand the code below, with (+). Comming from MS-SQL server, I never seem this before. Can some explain what the (+) does?

thanks

SELECT
tblA.FIRST_NAME,
tblA.lAST_NAME,
tblA.STREET_NUMBER,
btlA.CITY
FROM
tblA,
tblB
WHERE
LAST_NAME LIKE 'TRAN%'
and
tbla.CODE = tblB.CODE

SELECT
tblA.FIRST_NAME,
tblA.lAST_NAME,
tblA.STREET_NUMBER,
btlA.CITY
FROM
tblA,
tblB
WHERE
LAST_NAME LIKE 'TRAN%'
and
tbla.CODE = tblB.CODE(+)
 
The first one only returns rows in tblA where there is a match on CODE in tblB as per the WHERE clause.

The second one is doing a left outer join and will return all rows in tblA, even if there is no matching CODE in tblB. Since you aren't selecting any columns from tblB, the second one is equivalent to this...

Code:
SELECT
[indent]tblA.FIRST_NAME,
tblA.lAST_NAME,
tblA.STREET_NUMBER,
tblA.CITY
[/indent]FROM
[indent]tblA
[/indent]WHERE[indent]LAST_NAME LIKE 'TRAN%';[/indent]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top