Subject | Creating a view using COUNT |
---|---|
Author | killerion |
Post date | 2007-01-13T20:30:03Z |
I'm trying to create the following view:
create view VIEW_COMMITMENTS_LEFT ( ID_MEMBER, ID_DONATION,
TOTAL_MONTHS_PAID, MONTHS_COMMITED )
as
select
donation_commitments.id_member,
donation_commitments.id_donation,
COUNT(commitments_paid.month_paid),
donation_commitments.months_commited
from
donation_commitments,
commitments_paid
where
(commitments_paid.id_member = donation_commitments.id_member) AND
(commitments_paid.id_donation = donation_commitments.id_donation) AND
(donation_commitments.done <> 1)
I get the following error:
Invalid expression in the select list (not contained in either an
aggregate function or the GROUP BY clause).
Now I assume this is due to the COUNT, since without it I can create
the view, now any suggestions on how to get this to work or is there
some other error I can't see?
Jankowiak
create view VIEW_COMMITMENTS_LEFT ( ID_MEMBER, ID_DONATION,
TOTAL_MONTHS_PAID, MONTHS_COMMITED )
as
select
donation_commitments.id_member,
donation_commitments.id_donation,
COUNT(commitments_paid.month_paid),
donation_commitments.months_commited
from
donation_commitments,
commitments_paid
where
(commitments_paid.id_member = donation_commitments.id_member) AND
(commitments_paid.id_donation = donation_commitments.id_donation) AND
(donation_commitments.done <> 1)
I get the following error:
Invalid expression in the select list (not contained in either an
aggregate function or the GROUP BY clause).
Now I assume this is due to the COUNT, since without it I can create
the view, now any suggestions on how to get this to work or is there
some other error I can't see?
Jankowiak