[SQL] How can I use this subselect properly in an update?

2012-02-17 Thread John Tuliao
select substring(t1.called_number from t2.offset), t1.called_number from calls_join as t1, john_prefix as t2 where strpos(t1.called_number, t2.prefix) = '1' order by length(t2.prefix) desc limit '1' ; I'm having trouble using this as a sub-select in an UPDATE. Most of the

[SQL] Query question

2012-01-27 Thread John Tuliao
I seem to have a problem with a specific query: The inside query seems to work on it's own: select prefix from john_prefix where strpos(jpt_test.number,john_prefix.prefix) = '1' order by char_length(john_prefix.prefix) desc limit 1 but when I

Re: [SQL] Query Problem... Left OuterJoin / Tagging Issue

2012-01-17 Thread John Tuliao
, David Johnston wrote: On Jan 12, 2012, at 23:31, John Tuliao jptul...@eglobalreach.net mailto:jptul...@eglobalreach.net wrote: Hi, I've been working on this for quite awhile now and don't seem to get the proper query. I have basically 4 tables. 1. Table john_test contains the numbers

[SQL] Query Problem... Left OuterJoin / Tagging Issue

2012-01-12 Thread John Tuliao
Hi, I've been working on this for quite awhile now and don't seem to get the proper query. I have basically 4 tables. 1. Table john_test contains the numbers of the calls. 2. Table john_country contains the country with prefix. 3. Table john_clients contains the clients and their sub_id's