You are here: Re: Help with joining records « MsSQL Server « IT news, forums, messages
Re: Help with joining records

Posted by Matik on 12/14/06 17:03

Not sure this will help, because I'm not sure, did I fully understood
your problem.
If what you mean is like fallow:

B_BOL# from Table B can be a key either with BOL# or/and Chargeback#,
then I will try as fallow:

select * from TableB B
left join TableA A1
on B.B_BOL# = A1.BOL#
left join TableA A2
on B.B_BOL# = A2.Chargeback#

If you do not want to have doble records, you can ommite it with using
is not null (if it is always like this, that the BOL# is null when
chargeback# isn't null ... and opposite).

Or You can use case statement, by removing null records.

In the future, will be better, if you put the script, or some example
data, if the script will be to complicated.

Best regards

Matik

Rnt6872 napisal(a):
> Table A Table B
>
> BOL# B_BOL#
>
> Chargeback#
> Hi All,
> I have been struggling with this for the past few months. I have two
> tables that I'm inner joining on BOL#=B_BOL#. This works fine. Now for
> the problem....When there are chargeback# fields associated with B_BOL#
> they aren't being captured as additional records. None of my tables
> have primary keys because at any given time any field can contain a
> "null" value, so I am unable to assign a foreign key, I think. How can
> I attach the subsequent records to the main record to bring back the
> additonal data? Please help!!!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация