Sometimes I find some SELECT sentences that contain a double ON on the same JOIN: is it possible ? I don't knew it.

Claudio Diotallevi 21 Reputation points


SELECT dbo.Magmov.DtaDocum,

FROM dbo.Anagrafe

INNER JOIN dbo.TestaOrdAfo ON dbo.Anagrafe.TipoAna = dbo.TestaOrdAfo.TipoAna AND
dbo.Anagrafe.Cd_Ana = dbo.TestaOrdAfo.cd_Ana


INNER JOIN dbo.OrdineDettC ON dbo.MOVMAG_DETT.NrOrdine = dbo.OrdineDettC.NOrdine AND
dbo.MOVMAG_DETT.NrRiga = dbo.OrdineDettC.NRiga

INNER JOIN dbo.OrdAfo ON dbo.OrdineDettC.NOrdine = dbo.OrdAfo.NOrdCli AND
dbo.OrdineDettC.NRiga = dbo.OrdAfo.NRigaCli AND
dbo.OrdineDettC.Cd_Artico = dbo.OrdAfo.Cd_Artico AND
dbo.OrdineDettC.Cd_Cartell = dbo.OrdAfo.Cd_Cart AND
dbo.OrdineDettC.Cd_Colore = dbo.OrdAfo.Cd_Colore
ON dbo.TestaOrdAfo.NumOrd = dbo.OrdAfo.Numord

INNER JOIN dbo.Magmov ON dbo.OrdAfo.Id = dbo.Magmov.Id_Ordafo

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,544 questions
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. Anonymous

    Transact SQL is not currently supported here on QnA. They're actively answering questions in dedicated forums here.

    --please don't forget to Accept as answer if the reply is helpful--

    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows Server] Datacenter Management

    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees, and confers no rights.

    0 comments No comments