Re: comparing the last 4 characters...
Posted in 1995
I may have missed some of what you are trying to get to but you would get the last four digits of the telephone number as follows let x = length(record.phone_no) let p_telephone = record.phone_no[x-4,x] Then make the SQL statement with p_telephone. Good luck. J. David Schronce (david@stat_edi.cssnet.sanford.nc.us) wrote: : My brain must be on holiday, but I can't figure out how to compare the : last 4 digits of a telephone number to a like field in my database. : something like this: : select * from table1 : where table1.company = record.company : and table1.city = record.city : and table1.phone_no matches "*", record.phone_no[last 4 digits?] : Of course the above doesn't work, and to top it off record.phone_no is a : character field and may vary in length if it is a local, long distance or : international number. Hmmm... What I'd give for a BASIC RIGHT$ : function! : : Tips, tricks, ideas, pointers to where my brain is vacationing all : graciously accepted... : __ _ _ __ _ >> : | \\ __ ___ ___ __| | / _| __| |_ _ _ ___ _ _ __ ___ << : | | / _' \\ ' | / _' | \\_ \\/ _| ' \\| '_/ _ \\ ' \\/ _/ -_) C|~~| : |__/\\__,_|\\_/|_\\__,_| |__/\\__|_||_|_| \\___/_||_\\__\\___| `--' -- Neil - @storm@aztec.co.za < ANOTHER ESSEX LAD >