Hola...
Still trying to get to know DB2. Really want to use Automatic Summary Tables along with staging tables.
I'm using DB2 9.1 Express-C, WinXP. Nothing unusual about my environment; just a simple install of DB2 on my laptop for now as I practice.
Here's where I'm at:
CREATE TABLE foo AS ( SELECT
DECIMAL (AVG(bv.vote_value),4, 2) AS Vote_Average,
COUNT(bv.book_id) AS total_votes,
b.title_1, b.title_2, a.full_name, bv.book_id, ab.artist_id
FROM book_votes bv,
books b,
authors_books ab,
authors a
WHERE bv.book_id = ab.book_id AND
ab.book_id = b.id AND
ab.author_id = a.id
GROUP BY bv.book_id, b.title_1, b.title_2, ab.author_id, a.full_name)
DATA INITIALLY DEFERRED REFRESH DEFERRED;
*******DB20000I The SQL command completed successfully********
CREATE TABLE foo_stage FOR foo PROPAGATE IMMEDIATE;
****DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL20058N The fullselect specified for the materialized query table "BR.FOO" is not valid. Reason code = "4". SQLSTATE=428EC
I carefully read over the following documentation which directly speaks to my issue and the associated error code. I didn't see the issue - as it relates to a REFRESH DEFERRED MQT.
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.msg.doc/doc/sql20058.htm
Can anybody explain why this is failing?
Thanks in advance for any help!