MySQL Forums
Forum List  »  Newbie

Re: Newbie Help
Posted by: Peter Brawley
Date: December 09, 2012 01:03PM

drop table if exists t;
create table t(hotel char(1),roomtype char(8));
insert into t values('a','single'),('a','double'),('b','single'),('c','suite');

select hotel
from t
where roomtype in('single','double')
group by hotel
having count(distinct roomtype) = 2;
+-------+
| hotel |
+-------+
| a     |
+-------+

Options: ReplyQuote


Subject
Written By
Posted
December 09, 2012 12:33PM
Re: Newbie Help
December 09, 2012 01:03PM


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.