I have Books table - ISBN DECIMAL(10) NOT NULL UNIQUE,
TITLES CHAR(100) NOT NULL,
PUBLISHERS CHAR(100) NOT NULL,
PUBLICATION_DATE DECIMAL(4) NOT NULL,
GENRE CHAR(100) NOT NULL,
PRICE DECIMAL(10,2) NOT NULL
I have saleitem table - SALE_ID DECIMAL(3) NOT NULL,
ISBN DECIMAL(10) NOT NULL,
QUANTITY DECIMAL(2) NOT NULL,
HISTORY_ID DECIMAL(3) NOT NULL
I hate price history - HISTORY_ID DECIMAL(5) NOT NULL UNIQUE,
START_DATE DATE NOT NULL,
END_DATE DATE NOT NULL,
TOTAL_PRICE DECIMAL(10,2) NOT NULL
I've tried this query: Suppose to show:
Genre total price Quantity
Programming 230.00 55
Fiction 122.00 34
select sum(Quantity), sum(total_price), genre from saleitem, pricehistory,
books group by genre, books.isbn = saleitem.isbn, saleitem.history_id =
pricehistory.history_id, pricehistory.start_date between '2006-01-01' and
'2006-01-26' and pricehistory.end_date between '2006-01-02' and '2006-01-26'
order by pricehistory.start_date;
Atribute pricehistory.start_date must be GROUPed or used in an aggregate
function
What does that mean? Could some one fix it for me? I mean what should i change?
Database question!, I think this is a simple one.
Feb 1 2006, 08:31 AM, updated 20y ago
Quote
0.0150sec
0.46
5 queries
GZIP Disabled