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
 General SQL Server Forums
 New to SQL Server Programming
 INNER JOINS ON FOUR TABLES

Author  Topic 

sadbjp
INNER JOIN

41 Posts

Posted - 2007-05-14 : 16:59:15
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

7423 Posts

Posted - 2007-05-14 : 17:29:21
Homework, certification or interview question?

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

sadbjp
INNER JOIN

41 Posts

Posted - 2007-05-14 : 17:32:29
It is an interview question.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-05-14 : 17:42:10
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)

17689 Posts

Posted - 2007-05-14 : 18:29:22
Please post the DDL, sample data and expected result


KH

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-14 : 21:43:29
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

22864 Posts

Posted - 2007-05-15 : 09:24:00
<<
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)

17689 Posts

Posted - 2007-05-15 : 10:02:45
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 - 2007-05-16 : 14:29:15
Its pretty easy to make fun of others and you guys are loving it.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-05-16 : 14:52:28
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

191 Posts

Posted - 2007-05-16 : 15:12:45
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 - 2007-05-16 : 16:31:58
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

7423 Posts

Posted - 2007-05-16 : 16:42:57
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

22864 Posts

Posted - 2007-05-17 : 00:25:45
<<
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

843 Posts

Posted - 2010-08-19 : 03:40:43
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)

17689 Posts

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


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2010-08-19 : 04:16:13
quote:
Originally posted by khtan

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


KH
[spoiler]Time is always against us[/spoiler]





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)

17689 Posts

Posted - 2010-08-19 : 04:28:40
quote:
it came in active topic

the spammer bump it


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -