Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Assistance with a Query
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ryan.cook
Starting Member

USA
2 Posts

Posted - 06/17/2013 :  09:38:39  Show Profile  Reply with Quote
Hey, all;

I'm a bit new to SQL, but it's frequently used where I work. I've been delving a bit deeper into queries and ran into trouble with one.

What I'd like to do is:
-Find all rows in a table that have a specific value in a specific column.
-When a row is found, use the data from a different column to search another table

I apologize if that's somewhat vague. In the end, the goal is to search through a table, stop when a condition is met, then search another table with a specific column's data.

Thanks in advance!
Ryan

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 06/17/2013 :  09:44:25  Show Profile  Reply with Quote
it will like this


SELECT t2.*
FROM SecondTable t2
INNER JOIN FirstTable t1
ON t1.col2 = t2.col2
WHERE t1.SearchColumn = 'your value'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

ryan.cook
Starting Member

USA
2 Posts

Posted - 06/17/2013 :  10:06:13  Show Profile  Reply with Quote
Woo! Thank you, Visakh! I'll start fiddling around with that now :)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 06/17/2013 :  10:06:52  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000