Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2006, 08:19 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default inner join problem

Hi there,

I have a problem with the syntax for a multi-table inner join which I hope someone can help me with.

My SQL statement looks like this....
"SELECT orgs.documentref, mainser.name, ser.name, orgs.datein, serorgs.serid, orgs.title, orgs.shortdesc, orgs.webaddress, serorgs.webaddress, orgs.hits, orgs.webprefix, serorgs.webprefix, serorgs.title, serorgs.shortdesc, serorgs.hits, serorgs.datein, serorgs.serorgid, orgs.addressline1, orgs.addressline2, orgs.towncity, orgs.county, orgs.postcode, serorgs.supptelno, serorgs.suppemail, serorgser.serorgserid, serorgser.serorgid, serorgser.serid, serorgser.documentref, * FROM ((serorgser INNER JOIN orgs ON serorgser.documentref = orgs.documentref) INNER JOIN serorgs ON serorgser.serorgid = serorg.serorgid) ((INNER JOIN ser ON serorgser.serid = ser.serid) INNER JOIN mainser ON ser.mainserid = mainser.serid) WHERE (((orgs.active)=True)) ORDER BY mainser.name, serorgser.serid, serorgser.documentref, serorgs.title;

(sorry for the mouthfull of code!)
Basically I want to return all records from the SERORGSER table, and get related values from the ORGS table(1 record will be returned), SERORGS table(1 record will be returned), SER Table(1 record will be returned), & get values from the MAINSER table(1 record will be returned) based on the record found from the SER table.
We will exclude records where the value of the "orgs.active" field =True.

Hope this is clear !!
Many thanks for your help.
John


 
Old March 29th, 2006, 06:30 AM
Authorized User
 
Join Date: Mar 2006
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What problems are you having with this .. the only thing I can see is

Quote:
quote:We will exclude records where the value of the "orgs.active" field =True
this will include records with orgs.active = true. I would change the code to
Code:
WHERE (((orgs.active)<>True))





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Join/Where jpryor SQL Server 2005 2 April 12th, 2008 01:25 AM
Inner Join Problem rylemer SQL Language 2 October 21st, 2005 04:41 PM
Oracle 8i inner join and left join problem puteri_84 Oracle 2 August 19th, 2004 07:14 AM
JOIN problem kaz SQL Language 4 December 22nd, 2003 04:13 PM
SQL Inner Join Problem tp194 Classic ASP Databases 2 July 8th, 2003 09:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.