Jump to content

SubQuery Meltdown


morrisjohnny

Recommended Posts

As part of a course i'm having difficultly displaying the single result from the table `composition` i need to show `c_title` their is only one resulthere is my code.other than displaying this final field everything works. what am i missing?I've tried to add composition.c_title but it flicks back an error. it's habbit that i also use the table name before the column i know this isn't required

SELECT concert.concert_venue, concert.con_dateFROM concertWHERE concert_no = ANY (  SELECT performed_in  FROM Performance  WHERE performed = ANY (    SELECT c_no    FROM composition    WHERE c_no = ANY (      SELECT cmpn_no      FROM has_composed      WHERE cmpr_no = ANY (        SELECT comp_no        FROM composer        WHERE comp_is = ANY (          SELECT m_no FROM musician WHERE m_name = 'Andy Jones'        )      )    )  ))

Link to comment
Share on other sites

Thanks Guys, but i changed it to Joins as the area i was being marked on was about sub-selects i though i would have to do it as a subselect however i admitted defeat and done it all in a joinHere's the code i used incase anyone else is wonder and for future use

SELECT concert.concert_venue, concert.con_date, composition.c_titleFROM concert, performance, composition, has_composed, composer, musicianWHERE concert_no = performed_inAND performed = composition.c_noAND composition.c_no = has_composed.cmpn_noAND cmpr_no = composer.comp_noAND composer.comp_is = musician.m_noAND m_name = 'Andy Jones'

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...