Subject Re: [firebird-support] SQL Question
Author Scott Taylor
At 06:54 07/22/03, you wrote:
>Hi all,
>
>when I execute the following SQL, I get duplicates records. Anyone know why?
>
>There are 2 nozzles and 2 grades of fuel.
>
>SELECT T.Grade, G.Descrip,
>N.LSold as VolSold, N.MSold as MoneySold
>FROM Tanks T JOIN Nozzles N
>on
>T.Number = N.Tank
>JOIN
>Grades G
>ON
>T.Grade = G.Grade_Num
>Order by T.Grade, G.Descrip

Because you have two separate joins to TANKS: T.Number and T.Grade

Maybe if you show the table source (stripped for content of course) and
attempt to explain what you are trying to accomplish. I have an idea what
you are trying to do but I'm not very good at reading minds so I might be
wrong. ;)

When designing the database, T.TankID->N.TankID, and T.GradeID->G.GradeID,
may have made your life much simpler (hindsight)

Scott.