Groups | Blog | Home
all groups > sql server mseq > october 2005 >

sql server mseq : Matching fileds between two tables


Daniell
10/21/2005 3:49:04 PM
I hope I can explain this a little better. I have two tables that I need
information from. The first table has all but two fields that I need. I am
having two problems. First all I want to do is read the first table take the
part number and check the second table. If it is not there I want print the
information from the table and continue on reading the first table and if it
is there I want to take the invoice and print it with the information from
the first table. The second problem is the part number in the second table
is part of a large field(132 bytes). It is always at the same postion 10
David Portas
10/22/2005 12:28:01 AM
It sounds like you'll want an outer join. Example:

SELECT T1.col1, T1.col2, T1.part_num, T2.col1, T2.col2
FROM Table1 AS T1
LEFT OUTER JOIN Table2 AS T2
ON T1.part_num = SUBSTRING(T2.large_col, 10, 5) ;

--
David Portas
SQL Server MVP
--

[quoted text, click to view]

Daniell
10/24/2005 2:48:01 PM
Thanks I will give that a try.

[quoted text, click to view]
AddThis Social Bookmark Button