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
 One parameter 3 tables

Author  Topic 

serafon
Starting Member

1 Post

Posted - 2012-01-30 : 12:49:52
I'm very new to sql. I have 3 tables linked to each other. I want to send a parameter to one of the table which have relations with the other 2 tables. Then according to that value taken out from the first table i want to take out 2 values from the other 2 tables. For example: I have order table and that table has customerId and orderamount id as foreign keys. When i select a specific order from order table which has specific customerid and orderamountid, then i want to pull out customer name from customer table and orderamount from the orderamount table with corresponding IDs. And i need them combined. How can i do that?

X002548
Not Just a Number

15586 Posts

Posted - 2012-01-30 : 13:12:44
I read...blah, bla, blah

SELECT * FROM Table join table2 on table1.key = table2.key..etc


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-30 : 13:31:27
you need to learn about concept of joins in sql

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -