user791888
user791888

Reputation:

searching by all fields with like in 2 tables left join - performance issues?

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.

Upvotes: 2

Views: 122

Answers (1)

Utku Yıldırım
Utku Yıldırım

Reputation: 2277

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'

Upvotes: 1

Related Questions