Subject | Simple SQL problem |
---|---|
Author | Bart Smissaert |
Post date | 2012-02-24T09:03:52Z |
FB 1.5 on Windows, classic configuration.
Run the query via ODBC and ADO.
Have this simple SQL, which is meant to find mobile phone numbers with
a space in it:
select
p.patient_id,
ph.phone_number,
ph.phone_id
from
patient p left join
phonelink pl on (p.patient_id = pl.foreign_id and
pl.phone_type_id in(11, 506) and
pl.phonemethodid = 1 and
pl.phone_link_type = 2) left join
phone ph on (ph.phone_id = pl.phone_id)
where
p.main_reg_type = 1 and
ph.phone_number <> '' and
ph.phone_number like '% %'
order by
ph.phone_number asc
It runs fine, but finds numbers with no space in it.
Any idea why this is?
RBS
Run the query via ODBC and ADO.
Have this simple SQL, which is meant to find mobile phone numbers with
a space in it:
select
p.patient_id,
ph.phone_number,
ph.phone_id
from
patient p left join
phonelink pl on (p.patient_id = pl.foreign_id and
pl.phone_type_id in(11, 506) and
pl.phonemethodid = 1 and
pl.phone_link_type = 2) left join
phone ph on (ph.phone_id = pl.phone_id)
where
p.main_reg_type = 1 and
ph.phone_number <> '' and
ph.phone_number like '% %'
order by
ph.phone_number asc
It runs fine, but finds numbers with no space in it.
Any idea why this is?
RBS