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
 Working with two tables

Author  Topic 

richardlaw
Yak Posting Veteran

68 Posts

Posted - 2013-02-14 : 04:06:45
I’m new to working with SP’s and am enjoying the challenge. I’ve previously coded all the business logic using C#, but I am finding there is a lot more I can do via SP’s.

I’ve recently been looking for a way to search one table (select * from tbl_Contacts Where CustID = 3), and then perform another action on another table. In other words, for every CustID that = 3, do X on another table. What would be the best way to approach this?

Thanks as always

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-02-14 : 05:59:48
It depends on what that X that you want to do on another table is and how you want to relate that table with the tbl_Contacts. In most cases, you would do a join with table X. The table may be INNER JOIN or one of the OUTER JOINs. This page has a description and a few examples: http://www.w3schools.com/sql/sql_join.asp
Go to Top of Page
   

- Advertisement -