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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 DUMB AMIT

Author  Topic 

pamit_1982
Starting Member

13 Posts

Posted - 2007-05-03 : 09:40:30
Hi
this problem may be real dumb but for a dumber like me..

I have 3 tables TBla,tblb,tblc
tbla and tbl b have a common column x
whilr tblb and tblc have y
how to join these table as to get value accordingly.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-05-03 : 09:42:56
select a.*, b.*, c.*
from tbla as a
inner join tblb as b on b.x = a.x
inner join tblc as c on c.y = b.y


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

pamit_1982
Starting Member

13 Posts

Posted - 2007-05-03 : 09:49:11
Thanks Peter,
I tried all that but the damn data is not coming .
I tried all the joins.

guys ..
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-05-03 : 09:54:00
I have no idea what you mean by "accordingly".
Please post some sample data and your expected output.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-03 : 09:55:49
are ouy sure that the correct data is in the tables at all?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

pamit_1982
Starting Member

13 Posts

Posted - 2007-05-03 : 10:03:08
Sorry guys ..
There are duplicate data in the tables..
May be that is cousing problem
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-05-03 : 11:15:57
Duplicate records would not prevent the damn data from coming. Duplicate records would bring back too much damn data.
You need to make sure that for every damn record in table A there are matching records in table B, and for every damn record in table B there are matching records in table C. Otherwise, the damn inner joins will prevent any records from being returned.

e4 d5 xd5 Nf6
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-03 : 11:31:04
and DAMN to that

bad mood today bruce?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-05-03 : 13:25:25
quote:
Originally posted by pamit_1982

Thanks Peter,
I tried all that but the damn data is not coming .

I was just trying to help out the damn poster with his damn problem.

e4 d5 xd5 Nf6
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-05-03 : 14:52:43
quote:
Originally posted by blindman

Duplicate records would not prevent the damn data from coming. Duplicate records would bring back too much damn data.





haven't laughed that hard after reading a post in a while...


www.elsasoft.org
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-05-03 : 16:15:45
Its all in the

e4 d5 xd5 Nf6
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-05-03 : 16:16:01
...timing.

e4 d5 xd5 Nf6
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-05-03 : 17:17:41
Made I chuckle too ...

Next time one of the DEVs complains some SQL statement is not giving them the data they want I can just say "It'll be those damn inner joins" !!

Mind you, they'll probably just use Cartesian joins then, and a "little loop in VB to sort the data out"

Kristen
Go to Top of Page
   

- Advertisement -