If you think the table [TransitiPunti] has no records in it then yes that would stop any query using an INNER JOIN on that query from producing rows. note: Your existing query does use an INNER JOIN on that table (it uses old fashioned syntax regretably, but it is an inner join).
I suggest you test "progressively" so that you can work out the problem. "Start small", try that, if successful add items one at a time and try again.
As soon as you stop getting results you know what the last item was that you added, and it will be that item that causes the problem.
Here for example are 3 queries to try.
/* one table only (t1) */
SELECT
t1.Id
, t1.CodiceCaricoPericoloso
, t1.Confidenza
, t1.Istante
, t1.IstanteRicezione
, t1.Partizione
, t1.Targa
, t1.TargaSecondaria
, t1.UtmcInstanceId
, t1.VelocitaStimata
, t1.IdColore
, t1.IdCorsia
, t1.IdMarca
, t1.IdModello
, t1.IdNazionalita
, t1.IdSerie
, t1.IdTipologiaVeicolo
FROM dbo.TransitiView t1
WHERE t1.Istante BETWEEN '2015-09-03 00:16:50.693' AND '2015-09-03 23:16:50.693'
AND (t1.Partizione = 0 OR t1.Partizione = 6)
AND t1.IdCorsia = 1
ORDER BY t1.Istante DESC
;
/* two tables (t1 & t6) */
SELECT
t1.Id
, t1.CodiceCaricoPericoloso
, t1.Confidenza
, t1.Istante
, t1.IstanteRicezione
, t1.Partizione
, t1.Targa
, t1.TargaSecondaria
, t1.UtmcInstanceId
, t1.VelocitaStimata
, t1.IdColore
, t1.IdCorsia
, t1.IdMarca
, t1.IdModello
, t1.IdNazionalita
, t1.IdSerie
, t1.IdTipologiaVeicolo
FROM dbo.TransitiView t1
INNER JOIN Corsie t6 ON t6.Id = t1.IdCorsia
WHERE t6.Attiva = 1
AND t1.Istante BETWEEN '2015-09-03 00:16:50.693' AND '2015-09-03 23:16:50.693'
AND (t1.Partizione = 0 OR t1.Partizione = 6)
AND t1.IdCorsia = 1
ORDER BY t1.Istante DESC
;
/* three tables t1, t2, t6 */
SELECT
t1.Id
, t2.IdTransiti
, t1.CodiceCaricoPericoloso
, t1.Confidenza
, t1.Istante
, t1.IstanteRicezione
, t2.SQLServer_latitude
, t2.SQLServer_longitude
, t1.Partizione
, t1.Targa
, t1.TargaSecondaria
, t1.UtmcInstanceId
, t1.VelocitaStimata
, t1.IdColore
, t1.IdCorsia
, t1.IdMarca
, t1.IdModello
, t1.IdNazionalita
, t1.IdSerie
, t1.IdTipologiaVeicolo
FROM dbo.TransitiView t1
INNER JOIN TransitiPunti t2 ON t2.IdTransiti = t1.Id
INNER JOIN Corsie t6 ON t6.Id = t1.IdCorsia
WHERE t6.Attiva = 1
AND t1.Istante BETWEEN '2015-09-03 00:16:50.693' AND '2015-09-03 23:16:50.693'
AND (t1.Partizione = 0 OR t1.Partizione = 6)
AND t1.IdCorsia = 1
ORDER BY t1.Istante DESC
NEVER EVER use a mixture of old join syntax with the (better) explicit ANSI joins.
I also dislike redundant parentheses, I believe they confuse rather than aid.
SELECT
t1.Id
, t2.IdTransiti
, t1.CodiceCaricoPericoloso
, t1.Confidenza
, t1.Istante
, t1.IstanteRicezione
, t2.SQLServer_latitude
, t2.SQLServer_longitude
, t1.Partizione
, t1.Targa
, t1.TargaSecondaria
, t1.UtmcInstanceId
, t1.VelocitaStimata
, t1.IdColore
, t1.IdCorsia
, t1.IdMarca
, t1.IdModello
, t1.IdNazionalita
, t1.IdSerie
, t1.IdTipologiaVeicolo
FROM dbo.TransitiView t1
/*
LEFT OUTER JOIN Serie t0 ON t0.Id = t1.IdSerie
LEFT OUTER JOIN dbo.Colori t3 ON t3.Id = t1.IdColore
LEFT OUTER JOIN Modelli t4 ON t4.Id = t1.IdModello
LEFT OUTER JOIN Marche t5 ON t5.Id = t1.IdMarca
*/
INNER JOIN TransitiPunti t2 ON t2.IdTransiti = t1.Id
INNER JOIN Corsie t6 ON t6.Id = t1.IdCorsia
WHERE t6.Attiva = 1
AND t1.Istante BETWEEN '2015-09-03 00:16:50.693' AND '2015-09-03 23:16:50.693'
AND (t1.Partizione = 0 OR t1.Partizione = 6)
AND t1.IdCorsia = 1
ORDER BY t1.Istante DESC
In taking out the parentheses and correcting for the join syntax I think the query looks like the above. Note there is no apparent need for any of the left joined tables.
by the way this:
AND (t1.Partizione = 0 OR t1.Partizione = 6)
could be changed to:
AND t1.Partizione IN (0,6)