My system imports CSV files from multiple directories every day into a table called TB_ARQUIVO. In this file, it contains the name of the Hotel (Column HOTEL_NOME) and four types of Channels ... SEGMENT, ORIGIN, COMMUNICATION and VEHICLE, outside other columns ..
I have other tables where I have previously registered the information I use to score customers. That is, I have TB_HOTEl with all the registered hotels that are compared with the imported file in the HOTEL_NAME column. So as I have the following tables TB_SEGMENTO, TB_COMUNICACAO, TB_VEICULO and TB_ORIGEM.
Sometimes I get hotel names or channel names that are not registered in these tables. With this, I have to manually register and reimport the file generating a lot of work.
How do I generate a select that brings me all the hotel names + all the channels and compare them with the tables already registered in order to identify new hotels and new channels and send them by email?
Everything that exists in TB_ARQUIVO in the fields HOTEL_NAME, SEGMENT, COMMUNICATION, ORIGIN and VEHICLE and does not exist in TB_HOTEL, TB_SEGMENTO, TB_COMUNICACAO, TB_VEICULO and TB_ORIGEM should be sent by email.
Does anyone know a simple way to do this?