1
我有SQL查詢,它在地址字段中搜索表。我的問題是在城市領域。 我假設搜索欄的街道有門牌號碼,沒有他,但我忘記了像Kolin IV,KolínII等社區的劃分。我的問題是,不知何故可以從使用SQL函數的列中僅比較城市的名稱沒有任何跡象表明該地區屬於哪個地區?SQL-LIKE搜索地址字段
$where = " WHERE (LOWER(city) LIKE LOWER('%$fullAddress%')
OR LOWER(street) LIKE LOWER('%$fullAddress%')
OR CAST(postal_code AS TEXT) LIKE LOWER('%$fullAddress%')
OR CAST(house_number AS TEXT) LIKE LOWER('%$fullAddress%')
OR (LOWER(street || ', ' || city) LIKE LOWER('%$fullAddress%'))
OR (LOWER(street || ' ' || CAST(house_number AS TEXT)) LIKE LOWER('%$fullAddress%'))
OR (LOWER(city || ' ' || CAST(postal_code AS TEXT)) LIKE LOWER('%$fullAddress%'))
OR (LOWER(street || ', ' || city || ' ' || CAST(postal_code AS TEXT)) LIKE LOWER('%$fullAddress%'))
OR (LOWER(street || ' ' || CAST(house_number AS TEXT) || ', ' || city) LIKE LOWER('%$fullAddress%'))
OR (LOWER(street || ' ' || CAST(house_number AS TEXT) || ', ' || city || ' ' || CAST(postal_code AS TEXT)) LIKE LOWER('%$fullAddress%'))) AND deleteby is null";
$results = $fce->_slctSQL("public.configurations_view", "", "services", $where, "", " ORDER BY city ASC, street ASC, house_number ASC, postal_code ASC", "");
BTW:當我比較: Vrchlické789,歌林IV 28002 - 其確定 Vrchlické789,歌林28002 - 其失敗 –
比較一切的詳細地址似乎沒有必要。 –