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
Can you write this SQL statement? related news:
- What Do You Get When You Put 350 SQL Developers In A Room And Open Up A LiveMeeting Link? — Ward Pond's SQL Server blog
- Greetings From SQL PASS! — Ward Pond's SQL Server blog
- SQL Server 2005 SP2 Community Technology Preview Program — Bink.nu
- IBPhoenix: Firebird 2.0 Release Statement — Linux Today
- SQL Code Camp almost full — Darryl Burling @ Work
- SQL Server 2005 Service Pack 2 - Community Technology Preview (CTP) November 2006 — Bink.nu
- Running SysPrep on a Virtual Machine with SQL Server Installed — Virtual PC Guy's WebLog
- SQL Server 2005 盛宴系列之四十六:互联网行业综合应用案例 — TechNet 中文网络广播
- Linux.com: SQL-Ledger: Impressive Capabilities, But Needs Polish — Linux Today
- Rails: Generate SQL from Migrations — Artima Developer Buzz
Latest news from Channel 9:
- Samba Team asks Novell to reconsider
- New Site and I don't know any HTML
- This code smells
- Once you go Mac
- Contractors taking a day off?
- BIG troubles with MSDN Subscription renewal. Any ideas?
- Why I won't give up on the Zune...
- Get away from the computer...
- WCF Ships, Doug Purdy Dances, and Don Box Sings
- Template for a Good Spec?