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
bytes in the field
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
"Daniell" <Daniell@.discussions.microsoft.com> wrote in message
news:E1187FC7-9EA8-4EEE-B142-ECFA9807991A@.microsoft.com...
>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
> bytes in the field
|||Thanks I will give that a try.
"David Portas" wrote:
> 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
> --
> "Daniell" <Daniell@.discussions.microsoft.com> wrote in message
> news:E1187FC7-9EA8-4EEE-B142-ECFA9807991A@.microsoft.com...
>
>
No comments:
Post a Comment