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 |
|
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 follows1)Batch1)Batchid2)courseid3)locationid4)startdate5)enddate6)lecturefacultyid2)Feedback 1)Feedbatchid2)Batchid3)courseid4)facultyid5)Feedback3)Faculty1)facultyid2)facultyname4)course1)courseid2)coursename5)location1)locationid2)locationname6)batchlectureDetails1)blID2)facultyid7)SessionDelay1)delayid2)ActualEndDateUsing above tables i want to display the batches with following detailsbatchid,facultyname,locationname,feedback ,delay,coursenameSometimes 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 waySwati |
|
|
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" |
 |
|
|
Q
Yak Posting Veteran
76 Posts |
Posted - 2006-07-27 : 03:25:04
|
| SELECT batch.batchId, faculty.facultyName, location.locationName, feedback.feedback, course.courseNameFROM 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. |
 |
|
|
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 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|