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
 General SQL Server Forums
 New to SQL Server Programming
 table relationships

Author  Topic 

josephbenfeld
Starting Member

5 Posts

Posted - 2011-06-26 : 10:02:06
Hi I'm new and this is the first time I'm using SQL 2008 Express.

I have created a database in SQL 2008 express. My database is made of two tables. One contains data to be updated regularly on a monthly or weekly basis (600000 rows x 8 columns). The second table contains only descriptive informations (50 rows x 3 columns) to be used together with table 1.

Column (a) in table 1 contains the same information of column (a) in table 2. Table 2 contains an other column (b) from which I would need to extract data to be used with column (a) from table 1.

I need to extract data in excel (with pivot tables) from table 1. When I plot values for column (a) from table 1 I need to plot its correspondent value of column (b) from table 2 next to it.

I would much appreciate if you could teach me how to do it, step by step with SQL Server Management Studio if this is possible.

Thanks

Joseph

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-26 : 10:08:06
select
t1.colA,
t2.colB,
t1.colC,
t1.colD
from table1 as t1
join table2 as t2 on t2.colA = t1.colA


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

josephbenfeld
Starting Member

5 Posts

Posted - 2011-06-27 : 08:56:47
Thanks for this but I don't get how it would work when I extract data with Pivot tables.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-27 : 10:08:26
Pivot isn't really my thing...
Maybe another mate here can help...

But then please give table structure, sample data and wanted result.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

josephbenfeld
Starting Member

5 Posts

Posted - 2011-06-27 : 10:15:39
thanks. I have posted another topic.
Go to Top of Page
   

- Advertisement -