MySQL Forums
Forum List  »  Newbie

Problem with 2 solutions
Posted by: Kostas Vele
Date: October 08, 2012 07:19AM

Hi, I have a difficulty about two queries. I think are the same but it does not show me the same resultt

1. The first solution which is correct:
select ua.Email from interest i
join useraccount ua on i.UserAccountId = ua.Id
where i.SystemId = 'goldendeals.gr'
and i.StatusCode in (301, 302, 312)
and (select systemId from newslettersubscription where EmailAddress =ua.email order by SubscriptionDate asc limit 1) = 'Kati1.gr';

the second where there is the mistake:
Α.
select ns.EmailAddress,
( select systemId from newslettersubscription where EmailAddress =ua.email order by SubscriptionDate asc limit 1) as buyerSystem
from useraccount ua
join newslettersubscription ns on ns.EmailAddress=ua.Email and ns.SystemId = ua.SystemId
where ua.systemId='Kati1.gr' ;

Β.
select ua.Email from useraccount ua
join interest i on ua.Id = i.UserAccountId
where i.StatusCode in (302,301,312) and ua.SystemId='Kati2.gr'
and ua.Email in (
'skepsys@otenet.gr',
'kalliantra79@yahoo.gr',
'tychwn@hotmail.com',
'panvas85@hotmail.com',
...
'eblatsiou@yahoo.gr');

in the second solution I run Α. query and then I run Β.

Please find me the mistake
Thank you in advance !

Options: ReplyQuote


Subject
Written By
Posted
Problem with 2 solutions
October 08, 2012 07:19AM
October 08, 2012 07:26AM
October 08, 2012 07:46PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.