Hi all - first post and I hope I have the right section of the forum...
I have 3 seperate SELECT statements that I would like to combine into one. I have four Tables called "Client", "Letters", "Agreement" and "Rate", which are linked in that order via ID values. Rate also links to a number of other tables. They are all one-to-many relationships from left to right, but the Rate to the other tables is Many-To-One. I understand how to use Inner Join to join two together but would like to know how to join more than two tables together.
These are the SQL statements that I have already and hopefully someone can help me combine them because I can't seem to find the best method anywhere:
Can anyone help please?
Thanks very much,
I have 3 seperate SELECT statements that I would like to combine into one. I have four Tables called "Client", "Letters", "Agreement" and "Rate", which are linked in that order via ID values. Rate also links to a number of other tables. They are all one-to-many relationships from left to right, but the Rate to the other tables is Many-To-One. I understand how to use Inner Join to join two together but would like to know how to join more than two tables together.
These are the SQL statements that I have already and hopefully someone can help me combine them because I can't seem to find the best method anywhere:
Code:
SELECT
Client.ClientName,
Letters.LetterReference
FROM Letters
INNER JOIN Client
ON Client.ClientId = Letters.ClientId
Code:
SELECT
Letters.LetterReference,
Agreement.AgreementReference
FROM Agreement
INNER JOIN Letters
ON Letters.LetterId = Agreement.LetterId
Code:
SELECT
Agreement.AgreementReference,
Instrument.Instrument,
Underlying.Underlying,
Rate.RateQualifier,
Rate.Notes,
LowerRuleType.LowerRuleType,
Rate.LowerRule,
Rate.LowerRuleUnitId,
UpperRuleType.UpperRuleType,
Rate.UpperRule,
Rate.UpperRuleUnitId,
Rate.Rate,
Units.Unit,
RateType.RateType
FROM (((((((Rate
INNER JOIN Agreement
ON Rate.AgreementId = Agreement.AgreementId)
INNER JOIN Instrument
ON Rate.InstrumentId = Instrument.InstrumentId)
INNER JOIN Underlying
ON Rate.UnderlyingId = Underlying.UnderlyingId)
INNER JOIN RateType
ON Rate.RateTypeId = RateType.RateTypeId)
INNER JOIN Units
ON Rate.RateUnitId = Units.UnitId)
INNER JOIN LowerRuleType
ON Rate.LowerRuleTypeId = LowerRuleType.LowerRuleTypeId)
INNER JOIN UpperRuleType
ON Rate.UpperRuleTypeId = UpperRuleType.UpperRuleTypeId
Can anyone help please?
Thanks very much,