SQL Server Forums
Profile | Register | 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
 INNER JOINS ON FOUR TABLES
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sadbjp
INNER JOIN

41 Posts

Posted - 05/14/2007 :  16:59:15  Show Profile  Reply with Quote
Hi,

How can I do this using INNER JOIN:

4. From tables RubricReport, RubricReportTemplate, RubricReportDetail and SppTarget, get columns:
a. RubricReport
i. ReportID
ii. LastUpdate
iii. LastUpdateBy
b. RubricReportTemplate
i. IndicatorNumber
ii. Topic
iii. Part
iv. ILCDComponent
c. RubricReportDetail
i. LocalPerf
ii. GoalMet
d. SppTarget
i. Target
5. Matching these columns in the above four tables:
a. RubricReport.ReportID=RubricReportDetail.ReportID
b. RubricReportDetail.IndicatorID=RubricReportTemplate.IndicatorID
c. SppTarget.IndicatorNumber=RubricReportDetail.IndicatorNumber
d. SppTarget.Years=@DataYears


I have looked a lot but couldn't find INNER join for three tables.

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 05/14/2007 :  17:29:21  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
Homework, certification or interview question?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

sadbjp
INNER JOIN

41 Posts

Posted - 05/14/2007 :  17:32:29  Show Profile  Reply with Quote
It is an interview question.
Go to Top of Page

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 05/14/2007 :  17:42:10  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
Why do you think they gave you these questions to answer?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17598 Posts

Posted - 05/14/2007 :  18:29:22  Show Profile  Reply with Quote
Please post the DDL, sample data and expected result


KH

Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17598 Posts

Posted - 05/14/2007 :  21:43:29  Show Profile  Reply with Quote
Wait a minute .. .
quote:
INNER JOINS ON FOUR TABLES


Are you sure you want INNER JOIN ?

quote:
I hate using INNER joins





KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22754 Posts

Posted - 05/15/2007 :  09:24:00  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
<<
How can I do this using INNER JOIN:
>>

you cant because you hate INNER JOIN

You need to understand basic SQL
Here are some links

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp

Also make use of SQL Server help file


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17598 Posts

Posted - 05/15/2007 :  10:02:45  Show Profile  Reply with Quote
quote:
Originally posted by madhivanan

<<
How can I do this using INNER JOIN:
>>

you cant because you hate INNER JOIN

You need to understand basic SQL
Here are some links

http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp

Also make use of SQL Server help file


Madhivanan

Failing to plan is Planning to fail



That won't do. These site will teach him use INNER JOIN for his query.


KH

Go to Top of Page

sadbjp
INNER JOIN

41 Posts

Posted - 05/16/2007 :  14:29:15  Show Profile  Reply with Quote
Its pretty easy to make fun of others and you guys are loving it.

Edited by - sadbjp on 05/16/2007 14:30:48
Go to Top of Page

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 05/16/2007 :  14:52:28  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
It is very easy to make fun of others. It is also easy to ask people to do your work for you with no effort on your part to learn. Did you follow my advice at all from the previous thread?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

sanjnep
Posting Yak Master

USA
191 Posts

Posted - 05/16/2007 :  15:12:45  Show Profile  Visit sanjnep's Homepage  Reply with Quote
Here you go it is so simple.

declare @DataYears int
set DataYears = 2007

select
a.ReportID,
a.LastUpdate,
a.LastUpdateBy,
b.IndicatorNumber,
b.Topic,
b.Part,
b.ILCDComponent,
c.RubricReportDetail,
c.LocalPerf,
c.GoalMet,
d.Target
from RubricReport as a inner join RubricReportDetail as b on a.ReportID = b.ReportID
inner join RubricReportTemplate as c on b.IndicatorID = c.IndicatorID
inner join SppTarget as d on d.IndicatorID = c.IndicatorID
and d.Years=@DataYears
Go to Top of Page

sadbjp
INNER JOIN

41 Posts

Posted - 05/16/2007 :  16:31:58  Show Profile  Reply with Quote
Forget it. There is no point in arguing. BTW, I am done with what I had asked and I always try to come with answers on my own and then post questions on this forum. All I want to say is that, this is a great place but learner's should be motivated and respected.
Go to Top of Page

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 05/16/2007 :  16:42:57  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
sadbjp -- to get respect, you have to give respect back. Always remember that. You have to earn it by showing the willingness to learn. Just cutting and pasting interview questions and ignoring everyone that doesn't immediately give you the answer is not the way to learn or earn respect. I gave you great advice in the previous thread, and tried very hard to "motivate" you and told you how I and many others learned the basics of SQL, and then I asked you again about it here, and each time you ignored my efforts completely. Why should anyone help you or give you respect if you don't make any effort whatsoever on your part?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

madhivanan
Premature Yak Congratulator

India
22754 Posts

Posted - 05/17/2007 :  00:25:45  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
<<
but learner's should be motivated
>>

Didnt I motivate you by giving Learn SQL links?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

India
840 Posts

Posted - 08/19/2010 :  03:40:43  Show Profile  Reply with Quote
quote:
Originally posted by sadbjp

Its pretty easy to make fun of others and you guys are loving it.



@sadbjp -

In this site i feel that here is a lot of great SQL programmers are available for you
to solve your problem at the depth of solution
without getting irritated or ignoring your question.

Initially when i started this forum
i also asked many questions here
which might be homework questions but
i got a lot of very good response
to make me reach to the solution without giving me the solution.

so that i was able to reach to those type of solutions
on my own next time.
if someone will work for you. you will always be disabled.
I dont think you want to be, do you?

now i am able to learn from answers given to other's questions
by experts without questioning.

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17598 Posts

Posted - 08/19/2010 :  03:59:20  Show Profile  Reply with Quote
Vaibhav, you do realize that you are responding to a 3 year old thread right ?


KH
Time is always against us

Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

India
840 Posts

Posted - 08/19/2010 :  04:16:13  Show Profile  Reply with Quote
quote:
Originally posted by khtan

Vaibhav, you do realize that you are responding to a 3 year old thread right ?


KH
Time is always against us





No, because i did nt see date of second last reply.
as it came in active topic.
any ways i expressed my thoughts...
cheers...!!!

Vaibhav T

To walk FAST walk ALONE
To walk FAR walk TOGETHER
Go to Top of Page

khtan
In (Som, Ni, Yak)

Singapore
17598 Posts

Posted - 08/19/2010 :  04:28:40  Show Profile  Reply with Quote
quote:
it came in active topic

the spammer bump it


KH
Time is always against us

Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.12 seconds. Powered By: Snitz Forums 2000