no, per questi non ho proprio nessun record caricato.Originariamente inviato da serun
per quelli che non hanno inserito i dati avrai valore NULL nei campi delle seconda tabella.
Per la prima parte ci sono riuscita ed ho fatto cosi:
codice:SELECT IdUtente, Cognome, Nome, Email, Societa, AreaCompetenza, Mese, Quindicina, Anno, Esiste FROM ( SELECT DISTINCT tr.IdUtente, tu.Cognome, tu.nome, tu.email, ts.Descrizione AS societa, ta.Descrizione as AreaCompetenza, MONTH(tr.Data) AS mese, 1 AS quindicina,YEAR(tr.Data) AS anno,'Aperto' as Esiste FROM Tab_Report tr INNER JOIN Tab_Utenti tu ON tr.IdUtente = tu.IdUtente Left outer join Tab_Societa ts on tu.idsocieta=ts.idsocieta Left outer join Tab_AreaCompetenza ta on tu.idAreaCompetenza=ta.idAreaCompetenza WHERE 1=1 and tu.stato=1 and ts.idsocieta=2 AND tu.IdUtente=142 and (DAY(tr.Data) <= 15) AND (tr.Chiusura IS NULL OR tr.Chiusura = 0) and (YEAR(tr.data)='2011') UNION SELECT DISTINCT tr.IdUtente, tu.Cognome, tu.nome, tu.email, ts.Descrizione AS societa, ta.Descrizione as AreaCompetenza,MONTH(tr.Data) AS mese, 2 AS quindicina,YEAR(tr.Data) AS anno,'Aperto' as Esiste FROM Tab_Report tr INNER JOIN Tab_Utenti tu ON tr.IdUtente = tu.IdUtente Left outer join Tab_Societa ts on tu.idsocieta=ts.idsocieta Left outer join Tab_AreaCompetenza ta on tu.idAreaCompetenza=ta.idAreaCompetenza WHERE 1=1 and tu.stato=1 and ts.idsocieta=2 AND tu.IdUtente=142 and (DAY(tr.Data) > 15) AND (tr.Chiusura IS NULL OR tr.Chiusura = 0) and (YEAR(tr.data)='2011') ) DERIVEDTBL ORDER BY anno, Cognome,nome,mese, quindicinaMa come faccio per quelli che non ci sono?

Ma come faccio per quelli che non ci sono?
Rispondi quotando