Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: 2 tables join with null values


Message #1 by Bukovansky@a... on Wed, 8 Aug 2001 14:40:16 +0200
select * from goods G
	inner join delivery_types DT
		on DT.code_delivery_type = G.code_delivery_type OR
G.code_delivery_type IS NULL

And also I will suggest you assign each delivery type a identity, and join
tables using the identity.

ta

Wei

-----Original Message-----
From: Bukovansky@a... [mailto:Bukovansky@a...]
Sent: Wednesday, 8 August 2001 10:40 PM
To: sql language
Subject: [sql_language] 2 tables join with null values


Hi all,

I've got a problem with joining two tables.
First table has records about goods and second the types
of dalivery. This tables are in my SQL statment joined
this way:

SELECT * FROM goods G
	INNER JOIN delivery_types DT
	ON DT.code_delivery_type = G.code_delivery_type.

code_... is varchar(30) variable.

Trouble is, if the code at both tables is NULL value.
There aren't
joined. This record from goods is skipped.
How to force SQL 7 to join the rows with NULL values too?
Table delivery_tables is table with no records added,
deleted etc. Just only one record has code column
with NULL value.

Thanx for help.

Regards,

Richard Bukovansky


  Return to Index