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 |
rhinestone89
Starting Member
1 Post |
Posted - 2012-03-02 : 23:19:12
|
Good Day everyone. I'm trying to achieve something I've never tried before so please help me. I have three tables which are shown belowTable 1 id sex 1 m 2 f3 mTable 2 id beg_balance 1 12 3 3Table 3 id beg_balance 1 33 2 4I want to produce something like thisid sex beg_balance_from_table_2 beg_balance_from_table_31 m 12 332 f 43 m 4I've tried a lot of variations but nothing seems to work. Please help me on this. Thank you |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-02 : 23:42:39
|
as simple as thisSELECT t1.id,t1.sex,t2.beg_balance as beg_balance_t2,t3.beg_balance as beg_balance_t3FROM table1 t1LEFT JOIN table2 t2ON t2.id = t1.idLEFT JOIN table3 t3ON t3.id= t1.id ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|