searching by all fields with like in 2 tables left join - performance issues?
-
03-03-2021 - |
Pergunta
i am doing left join between 2 tables in firebird sql 2.5, and i need to search them as strings with like statement.
it is like :
Table: USER :
ID | NAME | TIME | ADDRESS_FK
.
Table : ADDRESS:
ID | STREET | CITY | COUNTRY
I would like after joining theese 2 tables, to perform search for a matching string on each of the result fields.
- what is the best performance way to do it, or this is the only one possible ?
Solução
Example Queries
Country Only
SELECT *
FROM "USER"
LEFT JOIN ADDRESS ON ("USER".ADDRESS_FK = ADDRESS.ID)
WHERE ADDRESS.COUNTRY LIKE 'TURKEY'
Country and City
SELECT *
FROM "USER"
LEFT JOIN ADDRESS ON ("USER".ADDRESS_FK = ADDRESS.ID)
WHERE ADDRESS.COUNTRY LIKE 'TURKEY' AND ADDRESS.CITY LIKE 'ISTANBUL'
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow