You are here: Need help with a join « MsSQL Server « IT news, forums, messages
Need help with a join

Posted by Danielle on 12/28/05 01:46

Hello group-
I am having a problem where joined tables are returning too many rows.
Here is my scenario -

I am trying to create a temporary table from parts of three tables -
the important columns are:

a.id
a.tran_date

b.id
b.geo

c.holiday_date
c.geo

My query is like this

select a.col1, b.col1 from a
inner join b on a.id = b.id
inner join c on c.geo = b.geo


With the parameters that I have, I get 144 rows with just the join of
tables a & b.

However, when I add the join to table c, I get 720 rows - there are (of
course) 5 rows in table c where the geo is the same as the geo in table
b.

The reason for the join is that I need to know if a.tran_date =
c.holiday_date and holidays differ by GEO.

I don't want this added information. Thoughts on what I am doing wrong?

Please let me know if you need more information

Thanks-
Danielle

 

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

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