I've a vista like this:
Agenzia Codice Nome Globmaster 012 NORTHWEST AIRLINES Globmaster 020 LUFTHANSA CARGO Globmaster 023 FEDERAL EXPRESS Globmaster 024 EUROPEAN AIR EXPRESS EAE Globmaster 988 ASIANA Globmaster 994 LINEAS AEREAS AZTECA Globmaster 995 B & H AIRLINES Globmaster 997 BIMAN Gabbiano 012 NORTHWEST AIRLINES Gabbiano 020 LUFTHANSA CARGO Gabbiano 023 FEDERAL EXPRESS Gabbiano 400 PALESTINIAN AIRLINES Gabbiano 406 UPS AIRLINES Gabbiano 407 AIR SENEGAL INTERNATIONAL
I need to modify the query so that it won't give duplicate codes (Codice) at the result:
SELECT 'Gabbiano' AS Agenzia, Codice, Descrizione, FlBSP, MastroForn, CapocForn, ContoForn, SottocForn, CodIVANazAtt, CommNazAttiva, CommIntAttiva,
FlCancellato, DataUltModifica, IDUtente, IDTerminale, CodAnagrafico, NoteDirPortAnd, NoteDirPortRit, ImpDirPortPax, ImpDirPortVei, GGScad,
PathCondGen
FROM dbo.TVTV0000
UNION
SELECT 'Istantravel' AS Agenzia, Codice, Descrizione, FlBSP, MastroForn, CapocForn, ContoForn, SottocForn, CodIVANazAtt, CommNazAttiva, CommIntAttiva,
FlCancellato, DataUltModifica, IDUtente, IDTerminale, CodAnagrafico, NoteDirPortAnd, NoteDirPortRit, ImpDirPortPax, ImpDirPortVei, GGScad,
PathCondGen
FROM IstanTravel.dbo.TVTV0000 AS Statistiche_1
UNION
SELECT TOP (100) PERCENT 'Globmaster' AS Agenzia, Codice, Descrizione, FlBSP, MastroForn, CapocForn, ContoForn, SottocForn, CodIVANazAtt,
CommNazAttiva, CommIntAttiva, FlCancellato, DataUltModifica, IDUtente, IDTerminale, CodAnagrafico, NoteDirPortAnd, NoteDirPortRit, ImpDirPortPax,
ImpDirPortVei, GGScad, PathCondGen
FROM Globmaster.dbo.TVTV0000 AS Statistiche_2
ORDER BY Codice
I don't even know why I get that silly TOP (100) PERCENT anyway ;)
Aucun commentaire:
Enregistrer un commentaire