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 |
|
paramu
Posting Yak Master
151 Posts |
Posted - 2009-11-17 : 04:30:36
|
| I have a Query select sup_ref_no,mpr_no from qotemst where sup_ref_no ='103006'Getting O/P like..... sup_ref_no mpr_no 103006 32 103006 32Good. No problem. Also I have a Queryselect mpr_no,mpr_date from mprmst where mpr_no ='32'Getting O/P like..... mpr_no mpr_date 32 2009-10-15 00:00:00:000 32 2009-10-15 00:00:00:000Good No problem. Also I have a Query select sup_ref_no,mpr_no from qotemst where mpr_no ='32'Getting O/P like..... sup_ref_no mpr_no 1551 32 1551 32 103006 32 103006 32Good No problem. Also I have a Query ----------------------------------------------Select q.sup_ref_no,q.item_code,q.mpr_no,m.mpr_date from qotemst q,mprmst m where q.sup_ref_no='103006' and m.mpr_no=q.mpr_noorSelect q.sup_ref_no,q.item_code,m.mpr_no,m.mpr_date from qotemst q,mprmst m where q.sup_ref_no='103006' and m.mpr_no=q.mpr_noGetting O/P like.....sup_ref_no item_code mpr_no mpr_date103006 SQUAWAS1 32 2009-10-15 00:00:00.000103006 SQUAWAS2 32 2009-10-15 00:00:00.000103006 SQUAWAS1 32 2009-10-15 00:00:00.000103006 SQUAWAS2 32 2009-10-15 00:00:00.000Doubling Problem, So how to solve it... Any joins?Any Ideas...Thanks Paramu @ PARANTHAMAN |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2009-11-17 : 07:21:24
|
| try using the FROM [table1] JOIN [table2] ON syntax instead of FROM [table1,table2]. This makes it MUCH easier to read and debug.http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-17 : 07:46:12
|
there are - 2 records in qotemst with mpr_no = 32 and- 2 records in mprmst with mpr_no = 32 so when you join these 2 tables together you will get 4 records. Unless you have another column in the join condition KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
paramu
Posting Yak Master
151 Posts |
Posted - 2009-11-18 : 00:30:50
|
| I Get Cleared, Thanks Khtan & DonAtWorkParamu @ PARANTHAMAN |
 |
|
|
|
|
|
|
|