Como combinar várias consultas SQL em uma única? [fechadas
Tenho essas várias consultas sql que desejo agrupar em uma única consulta, para evitar o envio de várias solicitações ao banco de dados do meu aplicativo (quero receber todos esses dados em uma única captura
1) select pin, officeNum, isVeteran from table18 where pin = 123;
2) select streetAddress, apartmentAddress, cityAddress, stateAddress from table1 where case = (select case from table18 where pin = 123);
3) select unitAddress, cityAddress, streetAddress, apartmentAddress from table5 where pin = 123;
4) select unitAddress, cityAddress, streetAddress, apartmentAddress from table55 where seqNum = 0 and rfa = (select rfa from table18 where pin = 123);
5) select unitAddress, cityAddress, streetAddress, apartmentAddress from table103 where histCode = 0 and case = (select case from table18 where pin = 123);
6) select phone, email from table715 where histSeqNum in (select max(histSeqNum from table715))
and histCode in (select max(histCode) from table715)
and case = (select case from table18 where pin = 123);
Aqui está o meu esquema:
(Desculpe o design incorreto, é de um banco de dados criado há 20 anos, não há chaves estrangeiras)
-Tabela18 (pino (PK), caso, officeNum, isVeteran)
-Tabela1 (case (PK), caseOfficer, streetAddress, apartmentAddress, cityAddress, stateAddress)
-Tabela5 (pino (PK), streetAddress, apartmentAddress, cityAddress, stateAddress)
-Tabela55 (rfa (CompositeKey), seqNum (CompositeKey), rfaAddress, streetAddress, apartmentAddress, cityAddress, stateAddress)
-Tabela103 (case (CompositeKey), histCode (CompositeKey))
-Tabela715 (case (CompositeKey), histSeqNum (CompositeKey), histCode (CompositeKey), telefone, email)