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
 SQL Server Development (2000)
 full outer join

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2006-07-27 : 03:03:17
Good Morning,
I have following tables in my sql database with the corresponding fields as follows
1)Batch
1)Batchid
2)courseid
3)locationid
4)startdate
5)enddate
6)lecturefacultyid


2)Feedback
1)Feedbatchid
2)Batchid
3)courseid
4)facultyid
5)Feedback

3)Faculty
1)facultyid
2)facultyname

4)course
1)courseid
2)coursename

5)location
1)locationid
2)locationname

6)batchlectureDetails
1)blID
2)facultyid

7)SessionDelay
1)delayid
2)ActualEndDate

Using above tables i want to display the batches with following details
batchid,facultyname,locationname,feedback ,delay,coursename

Sometimes feedback may be null.So i am taking full outer join of batch and the feedback but this way is not giving the desired output .
Plz suggest me the way

Swati

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2006-07-27 : 03:18:18
You need to provide the DDL for the tables, some insert-statements for sample data and the desired output...

--
Lumbago
"Real programmers don't document, if it was hard to write it should be hard to understand"
Go to Top of Page

Q
Yak Posting Veteran

76 Posts

Posted - 2006-07-27 : 03:25:04
SELECT batch.batchId,
faculty.facultyName,
location.locationName,
feedback.feedback,
course.courseName
FROM sessionDelay,
(((batch INNER JOIN location ON
batch.locationId = location.locationId)
INNER JOIN course ON batch.courseId = course.courseId)
LEFT JOIN feedback ON batch.batchId = feedback.batchId)
INNER JOIN faculty ON feedback.facultyid = faculty.facultyId;

Don't know which column to join to the delay.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-07-27 : 04:27:31
DDL = Data Description Language. In practice what that means (in this forum) is:

If you provide CREATE TABLE statements, and a handful of [hopefully representative!!] INSERT statements to put some data in the table, and then whatever attempt you have made which isn't working, plenty of people here will cut & paste that into their SQL tools, have a play, and make some suggestions.

The easiest way to generate the CREATE TABLE stuff is using Enterprise Manager's "Generate SQL" tools.

This isn't intended to be a rant, so hope it doesn't sound like that, but if you don't then only people with enough time to write all those statements will have a go, and FWIW today I don't have that time and I probably speak for some others too!

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-27 : 08:27:57
Also refer http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Madhivanan

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

- Advertisement -