I have this simple library checkout table created with the following columns and values inserted into it:
insert into CHECKOUT (MemID, Cat#, DateChkOut, DateDue, DateRet)
values (4, 'T 430.98 1956', '15-Mar-2011', '14-Jun-2011', '31-May-2011');
insert into CHECKOUT (MemID, Cat#, DateChkOut, DateDue, DateRet)
values (12, 'B 125.2 2013', '15-Mar-2011', '14-Jun-2011', NULL);
insert into CHECKOUT (MemID, Cat#, DateChkOut, DateDue, DateRet)
values (4, 'T 430.98 1956', '27-Dec-2012', '25-Mar-2013', NULL);
For each member, I need to list member id and the number of books ever checked out. I tried using:
select distinct MemID, count(distinct Cat#) from CHECKOUT;
but receive the error: not a single-group group function. Apparently I can't select a column and a count to display at the same time, but I could be wrong. Any ideas?