Find out the value of column A with a specified value in column B.

Source: Internet
Author: User
Create   Table Test (name Varchar ( 20 ) Not   Null , Holobby Varchar ( 20 ) Not   Null  );  Insert   Into Test Values ('  Adam  ' , '  Basketball  '  );  Insert   Into Test Values ( '  Bill  ' , '  Basketball  ' );  Insert   Into Test Values ( '  Bill  ' , '  Football  '  );  Insert   Into Test Values ( '  Cyper ' , '  Basketball  '  );  Insert   Into Test Values ( '  Cyper  ' , '  Badminton  '  );  Insert  Into Test Values ( '  David  ' , '  Basketball  '  );  Insert   Into Test Values ( '  David  ' , ' Badminton  '  );  Insert   Into Test Values ( '  David  ' , '  Table Tennis  ' );

Use SQL statements to find out who will play basketball and badminton and find out the name-Hoby combination.

SelectName, holobbyFromTestWhereHolobbyIn('Basketball','Badminton')Group ByNameHaving Count(Name)= 2

 

Address: http://www.iteye.com/topic/1122917

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.