Click here to Skip to main content
16,006,001 members
Home / Discussions / Database
   

Database

 
GeneralRe: ADO at Startup Pin
fordge22-Jan-03 15:22
fordge22-Jan-03 15:22 
GeneralDistinct Row Problem Pin
perlmunger6-Jan-03 13:28
perlmunger6-Jan-03 13:28 
GeneralRe: Distinct Row Problem Pin
l a u r e n6-Jan-03 13:35
l a u r e n6-Jan-03 13:35 
GeneralRe: Distinct Row Problem Pin
perlmunger6-Jan-03 13:46
perlmunger6-Jan-03 13:46 
GeneralRe: Distinct Row Problem Pin
l a u r e n6-Jan-03 14:40
l a u r e n6-Jan-03 14:40 
GeneralRe: Distinct Row Problem Pin
perlmunger6-Jan-03 18:34
perlmunger6-Jan-03 18:34 
GeneralRe: Distinct Row Problem Pin
Jeremy Oldham7-Jan-03 1:20
Jeremy Oldham7-Jan-03 1:20 
GeneralRe: Distinct Row Problem Pin
perlmunger7-Jan-03 5:38
perlmunger7-Jan-03 5:38 
Sounds good. I appreciate your help.

Here's a select on the top level CustomerID (which is '101' in this case)for the TA_Customer table (I used a reduced set of columns for brevity on this particular tables. The ones below it are, however, complete):

TA_Customer
------------
Customer_ID  CustomerID  LastName  FirstName
155603       101         Jones     Bob
155611       101         Jones     Jane
155612       101         Jones     Willy

TA_CustomerRelationships
-------------------------
CustomerID  Customer_ID1   Customer_ID2  RelationshipID
101         155603         155611        2
101         155603         155612        3

TA_CustomerRelationshipsLU
---------------------------
RelationshipID   Description
1                Husband
2                Wife
3                Son
4                Daughter
5                Father
6                Mother
7                Grandfather
8                Grandmother
9                Uncle
10               Aunt
11               Nephew
12               Niece
13               Cousin


For your convenience, here is the original query:
SELECT TA_Customer.Customer_ID,
       TA_Customer.FirstName,
       TA_Customer.LastCompanyName,
       TA_CustomerRelationshipsLU.Description
FROM   TA_CustomerRelationships INNER JOIN TA_CustomerRelationshipsLU ON
       TA_CustomerRelationships.RelationshipID =
       TA_CustomerRelationshipsLU.RelationshipID CROSS JOIN
       TA_Customer
WHERE  (TA_Customer.CustomerID = '101') AND (TA_CustomerRelationships.CustomerID = '101') AND
(TA_Customer.Customer_ID <> 155603)

Notice I added in an extra 'AND' clause. I only want to return the subordinate records. The top level record is the one for "Bob" whose Customer_ID is 155603.

As a reminder, I want the output to be this:
155611	Jane	Jones	Wife
155612	Willy	Jones	Son

Thanks for your help.

-Matt

------------------------------------------

The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
GeneralRe: Distinct Row Problem Pin
Jeremy Oldham7-Jan-03 6:11
Jeremy Oldham7-Jan-03 6:11 
GeneralRe: Distinct Row Problem Pin
perlmunger7-Jan-03 6:23
perlmunger7-Jan-03 6:23 
GeneralRe: Distinct Row Problem Pin
Jeremy Oldham7-Jan-03 6:55
Jeremy Oldham7-Jan-03 6:55 
GeneralInserting a row and retreiving the Identity value Pin
moredip6-Jan-03 12:47
moredip6-Jan-03 12:47 
GeneralRe: Inserting a row and retreiving the Identity value Pin
l a u r e n6-Jan-03 13:38
l a u r e n6-Jan-03 13:38 
GeneralRe: Inserting a row and retreiving the Identity value Pin
moredip6-Jan-03 15:12
moredip6-Jan-03 15:12 
GeneralRe: Inserting a row and retreiving the Identity value Pin
Paul Riley6-Jan-03 14:52
Paul Riley6-Jan-03 14:52 
GeneralRe: Inserting a row and retreiving the Identity value Pin
moredip6-Jan-03 15:16
moredip6-Jan-03 15:16 
GeneralSOLUTION Re: Inserting a row and retreiving the Identity value Pin
moredip7-Jan-03 8:18
moredip7-Jan-03 8:18 
QuestionUnmanaged ADO.NET? Pin
clintsinger6-Jan-03 12:32
clintsinger6-Jan-03 12:32 
GeneralSQL Connection Problem! Pin
dyerstein6-Jan-03 5:58
dyerstein6-Jan-03 5:58 
GeneralRe: SQL Connection Problem! Pin
Richard Deeming6-Jan-03 6:15
mveRichard Deeming6-Jan-03 6:15 
GeneralRe: SQL Connection Problem! Pin
dyerstein6-Jan-03 6:25
dyerstein6-Jan-03 6:25 
GeneralRe: SQL Connection Problem! Pin
leppie6-Jan-03 6:46
leppie6-Jan-03 6:46 
GeneralTable optimization Pin
alex.barylski5-Jan-03 7:39
alex.barylski5-Jan-03 7:39 
GeneralRe: Table optimization Pin
Matt Gullett5-Jan-03 9:54
Matt Gullett5-Jan-03 9:54 
GeneralRe: Table optimization Pin
alex.barylski5-Jan-03 12:54
alex.barylski5-Jan-03 12:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.