Jump to content

Omoruyi

Members
  • Posts

    2
  • Joined

  • Last visited

Omoruyi's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hi guys, i need to finish an assignment but keep getting the error: ERROR 1111 (HY000): Invalid use of group function The assignment goes as follows: Give a list of cruises (c_code, description) for all cruises and their number of passengers that have more passengers then average. There are 3 tables in the database: Booking, cruises and passengers. My code is :SELECT C_CODE, C_DESCRIPT, COUNT(DISTINCT(B_PASS)) FROM CRUISE, BOOKING WHERE (CRUISE.C_CODE =BOOKING.B_CRUISE) GROUP BY C_CODE HAVING COUNT(DISTINCT(B_PASS)) > AVG(COUNT(DISTINCT(B_PASS))); Obviously I'm doing something wrong.. Does anyone know what I'm doing wrong ? thanks in advance, Omoruyi
×
×
  • Create New...