>Try
>
...
> LEFT JOIN InvoiceI ON Video.Numero=InvoiceI.NoVideo
> LEFT JOIN Invoice ON InvoiceI.NoInvoice=Invoice.Numero
> AND Invoice.AddUser=1
> WHERE Program.Active
> AND (InvoiceI.NoVideo IS NOT NULL
> OR Video.Numero = (
> SELECT MIN(Video.Numero) FROM Program p2
> JOIN Video v2 ON P2.Numero=V2.NoProgram
> WHERE p2.Numero = Program.Numero)
> )
>
This works as it gets the first video of the program but it still also retrieves the video purchased which is the second one. I am trying to adjust the SQL to only get the first video of the program no matter what video was purchased.