この sql ステートメントを作成すると、6 つの同じレコードが返されます。したがって、2 つのレコードが返されると予想すると、各レコードが 6 つ返されるので、合計で 12 になります。
SELECT
ce2.*
FROM customerentry ce, customerentrytrace cet, customerentry ce2
WHERE ce.accountid = 1
AND ce.companyid = 1
AND ce.accountid=cet.accountid
AND ce.accountid=ce2.accountid
AND ce.companyid=cet.companyid
AND ce.companyid=ce2.companyid
AND cet.documentno = '2012Faktura1'
AND cet.documenttype = 1
AND ce2.documentno = cet.offsetdocumentno
AND ce2.documenttype = cet.offsetdocumenttype
ORDER BY created;
を追加することで解決できることはわかっていますdistinct
が、同じレコードが 6 つ返される理由を知りたいです。誰でも私を助けることができますか?