Comparing a value from one table, with interval in another table

0

I'm very lazy in Access, but I need to use it to solve a problem.

Assuming I have two Tables (just to give an example):

Table A:

CEP INICIO | CEP FINAL | CDD | CTC
20000-000  | 29999-999 | CDD Exemplo 1 | CTC Exemplo 1
30000-000  | 39999-999 | CDD Exemplo 2 | CTC Exemplo 2
40000-000  | 49999-999 | CDD Exemplo 3 | CTC Exemplo 3

Table B:

NOME | CEP
Fulano | 31564-888
Joãozinho | 22559-010
Pedrinho | 44411-000

How can I know what the value of CDD and CTC is for people in table B ??

    
asked by anonymous 29.06.2017 / 20:10

1 answer

0

Create a new query (menu Criar > Design da Consulta) and, in design mode (clique com o botão direito e selecione Modo SQL) , enter the code below:

SELECT cliente.cep, cliente.*, preco.*
FROM cliente, preco
WHERE (((cliente.cep)>=[preco]![cepinico] And (cliente.cep)<=[preco]![cepfim]));

Then just run

    
29.06.2017 / 20:18