I have 3 tables. They are inner joined. When I choose to select from all three tables I get a cartesian product.
I've used distinct and I've tried cross apply with top 1. Top 1 brings back the right amount of records but it repeats the fields used in that select top N.
Basic question. Can you select from 3 different tables and avoid a cartesian result? I can have all three tables joined and with distinct I can get records from two of the tables without a cartesian. It is when I choose to select from a third is where the cartesian appears.
If this is possible, what other tsql commands/constructs should I be experimenting with? http://imageshack.us/f/255/50353790.png/
SELECT CRT.[TransactionID]
,CRT.[creditrewardsID]
,CRT.[OwnerID]
, CRT.[TransactionDate]
,CRT.[ItemID]
,CRT.[VALUE]
,CRM.First
,CRM.MI
,CRM.Last
,CTI.fn
,CTI.ln
FROM [ownership].[dbo].[creditrewardsTransactions] CRT
Join [ownership].[dbo].[creditrewardsMembers] CRM
on CRT.creditrewardsid = CRM.[creditrewardsID]
Join [Exchange].[dbo].[CreditTourInfo] CTI
on CRM.CRMemberNum = CTI.PRIMECRPNum
--where CRT.creditrewardsID = 11111