getut
Starting Member
7 Posts |
Posted - 2014-10-23 : 17:25:31
|
I have T1 and T2. I am trying to join them in a view that shows everything in T1, except also with the corresponding price. I keep getting output that has items TIMES the number of stores for store 1, them items TIMES the number of stores for store 2, etc. What am I doing wrong. I've tried inner, left, right and all give exactly the same result. Instead of getting 6 rows of output I get 12 rows... 6 rows for Store 1 and 6 rows for Store 2.Sample query that is messing up for me.select T1.StoreID, T1.ItemID, T1.ItemDesc, T2.Price from T1 left join T2 on T1.ItemID = T2.ItemIDSample T1StoreID, ItemID, ItemDesc1,10,'Apples'1,20,'Oranges'1,30,'Bananas'2,10,'Apples'2,20,'Oranges'2,30,'Bananas'Sample T2StoreID, ItemID, Price1,10,1.251,20,1.101,30,1.052,10,1.202,20,1.122,30,1.06I'm WANTING the following output:StoreID, ItemID, ItemDesc, Price1,10,'Apples',1.251,20,'Oranges',1.101,30,'Bananas',1.052,10,'Apples',1.202,20,'Oranges',1.122,30,'Bananas',1.06But I GET this:StoreID, ItemID, ItemDesc, Price1,10,'Apples',1.251,10,'Apples',1.201,20,'Oranges',1.101,20,'Oranges',1.121,30,'Bananas',1.051,30,'Bananas',1.062,10,'Apples',1.252,10,'Apples',1.202,20,'Oranges',1.102,20,'Oranges',1.122,30,'Bananas',1.052,30,'Bananas',1.06 |
|