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 |
|
new2sql_
Starting Member
2 Posts |
Posted - 2008-12-01 : 19:41:19
|
| I am trying to do a join on three tables. We will call the first table1, and the next table2 and so on. In table1, I have three columns that I am interested in returning. Lets call them ClientID, ClientName and Address. In table 2, there is a column called ClientID#--which is exactlty the same thing as column ClientID in table1 (same data-different column name). Lastly, in table 2, I want to return 3 other columns called BillingAdd, BillingCity, Billingstate. None of these columns have a corresponding value in table1 or table3... I simply need to return them so that when ClientID# is returned, I see the address and Billing Address City and State. In table 3, called Time, I want to return ClientID again and Columns Time, Billed. The end result should show me the client ID, ClientName, City, Address, State and the Time (which would be the number of hours that the client has been billed, and lastly the Billed Column __which is a total number of hours that we billed a client..Thank you for any assitance |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-12-01 : 19:54:28
|
| http://www.w3schools.com/sql/default.asp |
 |
|
|
new2sql_
Starting Member
2 Posts |
Posted - 2008-12-01 : 21:46:01
|
thanks got it!quote: Originally posted by new2sql_ I am trying to do a join on three tables. We will call the first table1, and the next table2 and so on. In table1, I have three columns that I am interested in returning. Lets call them ClientID, ClientName and Address. In table 2, there is a column called ClientID#--which is exactlty the same thing as column ClientID in table1 (same data-different column name). Lastly, in table 2, I want to return 3 other columns called BillingAdd, BillingCity, Billingstate. None of these columns have a corresponding value in table1 or table3... I simply need to return them so that when ClientID# is returned, I see the address and Billing Address City and State. In table 3, called Time, I want to return ClientID again and Columns Time, Billed. The end result should show me the client ID, ClientName, City, Address, State and the Time (which would be the number of hours that the client has been billed, and lastly the Billed Column __which is a total number of hours that we billed a client..Thank you for any assitance
|
 |
|
|
|
|
|
|
|