|
Posted by Erland Sommarskog on 12/14/06 22:50
Rnt6872 (r_fordjr@msn.com) writes:
> 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!!!
1) The standard recommendations for this type of questions, is that
you post a) CREATE TABLE statements for the tables involed. b) INSERT
statements with sample data. c) the desired result given the sample.
This sort of information helps tremendously to understand what you
want to achieve. Also it makes it very easy to develop a tested
solution.
2) If all your columns can be nullable at any time, you have a very
difficult data model to work with. Most people would probably say
that your data model is flat wrong. Maybe there is a good reason
to have all columns nullable, but it sounds very suspicious.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|