MySQL Forums
Forum List  »  Newbie

Re: Newbie question
Posted by: Louise Fagan
Date: October 16, 2014 04:48PM

But this would only return my clients who have one account or the other. What I want is clients that have both checking and savings account which is why I was using AND instead of OR.
The funny thing is that I also have a column labelled account_type_ID which is "1" for checking accounts and "2" for savings account. If I query using account_type_id, I get the right answer.
SELECT client_id from accounts where account_type_id = 1 AND 2; will give me the right answer. Why can't I get the same answer using the account_type_name is beyond me. I thought for sure it had to do with syntax which I know is a bit different but something eludes me here.

Options: ReplyQuote


Subject
Written By
Posted
October 16, 2014 03:10PM
October 16, 2014 04:40PM
Re: Newbie question
October 16, 2014 04:48PM
October 17, 2014 08:05AM
October 16, 2014 04:43PM
October 16, 2014 04:58PM


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.