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 |
salmonraju
Yak Posting Veteran
54 Posts |
Posted - 2006-10-21 : 05:04:07
|
hello, I have two tables say tab1,tab2 . tab2 contains a foreign key relationship with tab1 (tab1 contains primary key)will it possible to write a command like this select * from tab2 where tab1.id=5i.e, can i check a feild in parent table (tab1.id) in child tablebefore retrival. please suggest me if u can |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-10-21 : 06:24:08
|
It seems you need to use JoinsSelect C.columns from Child C inner join Parent Pon C.id=P.idor post some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-10-21 : 07:26:35
|
What is the linking field between both the tables? select * from tab2 where tab1.id=5 You can not do like this.. first you require to join the tables using the join. and then in the where clause you can specify the conditions. You require to Learn SQL,Do refer to the following links. http://www.sql-tutorial.net/http://www.firstsql.com/tutor.htmhttp://www.w3schools.com/sql/default.aspChiraghttp://chirikworld.blogspot.com/ |
 |
|
|
|
|