SQL question (not as difficult as the others)
Trying to create a list of customers and how many charters each has booked:
I get this error:
Any ideas?
Code:
SELECT (c.cus_fname ||' '|| c.cus_lname) Customer, COUNT(ch.char_date) as "Num of Booked Charters" FROM hartmar.customer c JOIN hartmar.charter ch ON c.cus_code = c.cus_code GROUP BY Customer ;
ERROR at line 3:
ORA-00904: "CUSTOMER": invalid identifier
ORA-00904: "CUSTOMER": invalid identifier
Nevermind, I got it:
Code:
SELECT (c.cus_fname || ' ' || c.cus_lname) Customer,
COUNT(ch.char_trip) as "Number of Charters"
FROM hartmar.customer c JOIN hartmar.charter ch ON c.cus_code = ch.cus_code
GROUP BY c.cus_fname, c.cus_lname
;


