Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 query in 1 to n relation tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-08-16 : 09:33:10
Kaka writes "I have two table t1 and t2, one of the fields in t2 is also in t1 and there relationship is 1: Many..
I would like to have a query that produces a joing of the two and rows of the query should not be duplicates for columns from t1. My intended result sample:

t1x1 t2y1 t2y2 t2y3
t1x2 t2y1 t2y2
t1x3 t2y1 t2y2 t2y3 t2y3

The maximum that index for y can grow to is unknown. Hence can create a table with limited number of columns.

Kaka"

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-08-16 : 09:55:18
I guess you need to normalize, since there is no way you can create unlimited columns for any table.

Chirag
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-08-16 : 10:09:41
What is the original DDL for the two tables?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -