RSS Search

News  Feeds  Tags  Search Shortcuts

FeedsFarm.com > Can you write this SQL statement?

Can you write this SQL statement?

14th Nov 2006, 00:57 GMT

Need a little help with my SQL ;) It seems simple but I can't get the data I need, here is the setup. I have 10 tables, they are all identical except for 1 column. Each table has 4 keys, PK1-4 and then one extra column with an integer value. So for Table 1 lets call this extra column C1. Table 1: PK1, PK2, PK3, PK4, C1 Table 2: PK1, PK2, PK3, PK4, C2 Table 3: PK1, PK2, PK3, PK4, C3 ..... to 10. I am trying to get the data out of these 10 tables into a single table that looks like this: NewTable: PK1, PK2, PK3, PK4, C1, C2 .... C10. I am doing it in code but its slow. I was wondering if I could do a fancy select against 10 tables that will return rows that have all the keys and colums, grouped by the keys. Then I can do a select into my newtable. :) Generally speaking the set of keys will exist in each table but that might not always be true so for those values we'll accept null. Thanks, -c

View full story at channel9.msdn.com

Can you write this SQL statement? related news:

Latest news from Channel 9: