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.
Author |
Topic |
dan963
Starting Member
3 Posts |
Posted - 2012-04-29 : 12:26:47
|
Hi,I have 3 tables and I'm trying to merge data from all 3 tables into a 2 column view and if anyone can help that would be great. I want the column names from Table B and Table C to be entered into the Field column in Table A and the rows from Table B and Table C to be entered into Table A's Value column.Table A: (2 column field and value)Details ValueID 1Employee No 123456Leaving Date 01-05-2012Leaving Reason 11Table B: (2 columns)IDDate Notified01-04-2012Table C: (a lookup table for Leaving Reason)DetailEarly Retirement |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-29 : 12:40:09
|
[code]insert TableAselect 'IDDate',IDDatefrom tableBunion allselect 'Notified',Notifiedfrom tableBunion allselect 'Detail',DetailFROM tableC[/code]I hope there's a column which is common across tables by which you link it, but you've not shown it in example above. in that case you need to include that column also in inserts------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
dan963
Starting Member
3 Posts |
Posted - 2012-04-29 : 12:53:04
|
Thanks for the reply. I accidently posted it without putting all the info. If you could look at the other post I posted shortly afterwards, it has all the correct info. Thanks again |
 |
|
|
|
|