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 |
|
jonahpup
Starting Member
4 Posts |
Posted - 2007-09-13 : 19:05:18
|
Hi there.I am wanting to display some fields from 5 different tables.Here is a database diagram to show how the tables are linked. Basically what I want to show is:LastName, FirstName (ConsultantName), Actionwhen CaseStatus is anything other than "Declined" or "Invalid"If anyone could help me that would be great...CheersChris |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-13 : 19:10:41
|
SELECT at.LastName, at.FirstName, ct.ConsultantName, art.ActionFROM ApplicationTable AS atINNER JOIN ActionRequestTable AS art ON art.ApplicationUID = at.ApplicationUIDINNER JOIN ApplicantTable AS at ON at.UID = at.ApplicantUIDINNER JOIN ConsultantTable AS ct ON ct.UID = at.ConsultantUIDINNER JOIN CaseStatusTable AS cst ON cst.UID = at.CaseStatusUIDWHERE cst.CaseStatus NOT IN ('Declined', 'Invalid') E 12°55'05.25"N 56°04'39.16" |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2007-09-13 : 19:13:47
|
| Is this for a school project?Select C.LastName, C.FirstName, B.ActionfromApplicationTable A LEFT JOIN ActionRequestTable B ON A.Uid = B.ApplicationUidLEFT JOIN ApplicantTable C ON A.ApplicantUid = C.UidLEFT JOIN ConsultantTable D ON A.ConsultantUid = D.UidLEFT JOIN CaseStatusTable E ON A.CaseStatusUid = E.UidWhere E.CaseStatus not in ('Declined','Invalid')alternativelyWHERE E.CaseStatus <> 'Declined' and E.CaseStatus <> 'Invalid'PS: If anyone is interested in a SQL Server position in Connecticut with excellent pay send me your resume to ValterBorges@msn.com |
 |
|
|
|
|
|