2 Replies - 421 Views - Last Post: 06 October 2013 - 06:46 PM Rate Topic: -----

#1 Tree55Topz  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 84
  • Joined: 06-September 12

WHERE clauses

Posted 06 October 2013 - 01:03 PM

Hello, I need to run a query that will show who has an IQ above 120 and who speaks both english and japanese. I have two tables. applicant(person, iq, sex) and speaks(person, lang). What is wrong with my logic here?!
select person, iq
from applicant
where iq > 120 and
(select lang
   from speaks
     where lang = 'English' and lang = 'Japanese');

Thank you for your help
Is This A Good Question/Topic? 0
  • +

Replies To: WHERE clauses

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9059
  • View blog
  • Posts: 34,018
  • Joined: 12-June 08

Re: WHERE clauses

Posted 06 October 2013 - 01:05 PM

You should use a join on applicant to speaks on the person id.. and your where clause should be the id > 120 and (lang = english or lang = japanese).
Was This Post Helpful? 2
  • +
  • -

#3 Tree55Topz  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 84
  • Joined: 06-September 12

Re: WHERE clauses

Posted 06 October 2013 - 06:46 PM

Thank you!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1