Hi,
I found the solution for this issue. I separate into 2 queries and put
the result onto an array, and do PHP array_intersect_assoc to match.
Much more simpler, fast, about 200 thousands record matched in 10
seconds. Many thanks for your helps.
Regards,
Willy
On Thu, 2008-05-22 at 07:40 -0700
Sub queries suck in mysql. It is probably worth while to post the results of:
EXPLAIN SELECT msgdata
FROM sent_sms
WHERE momt = 'MT'
AND binfo IN (SELECT
binfo
FROM sent_sms
WHERE momt = 'DLR')
Are binfo and momt indexed? If not, they probably should be. A
replacement for the
Hi,
Thanks for the reply. The query seems doing something but after minutes
of waiting it still return no result.
Regards,
Willy
On Wed, 2008-05-21 at 23:06 -0400, David Lazo wrote:
> Would this work for you?
>
> SELECT msgdata
> FROM sent_sms
> WHERE momt = 'MT'
> AND binfo IN (SELECT
>
Would this work for you?
SELECT msgdata
FROM sent_sms
WHERE momt = 'MT'
AND binfo IN (SELECT
binfo
FROM sent_sms
WHERE momt = 'DLR')
David
On 5/21/08 10:30 PM, "sangprabv" <[EMAIL PROTECTED]> wrote:
> Hi,
> I tried to look for records from a table with this query:
Hi,
I tried to look for records from a table with this query:
SELECT msgdata FROM sent_sms WHERE momt = 'MT'AND binfo = ( SELECT
binfo FROM sent_sms WHERE momt = 'DLR' )
But MySQL returns this error:
#1242 - Subquery returns more than 1 row
I tried also with ANY, IN, EXISTS.
And modified the quer
Short-answer: use "IN" instead of "="
Long-answer:
Your query is kind of weird. I think you want to use "IN":
SELECT memberid, fullname FROM members WHERE memberid IN (select
distinct memberid FROM familymembers)
The equals implies an exact match between the top-level, and the
sub-query, b
i get an error when i run the query below though SQLyog.
SELECT memberid,fullname FROM members WHERE memberid =
(select distinct memberid FROM familymembers)
the error is
Error Code : 1064
You have an error in your SQL syntax. Check the manual that corresponds to your
MyS
Consider the following schema and data:
CREATE TABLE person (pid INTEGER, name CHAR(5));
CREATE TABLE phone (pid INTEGER, num CHAR(10));
INSERT INTO PERSON VALUES (1, 'Bob');
INSERT INTO PERSON VALUES (2, 'Jane');
INSERT INTO PHONE VALUES (1, '12345');
INSERT INTO PHONE VALUES (1, '23456');
INSER