3 messages in com.mysql.lists.mysqlRe: Help with CREATE SELECT Statement
FromSent OnAttachments
Carlos Vazquez11 Feb 2004 05:24 
Carlos Vazquez11 Feb 2004 05:42 
Roger Baklund11 Feb 2004 07:21 
Subject:Re: Help with CREATE SELECT Statement
From:Roger Baklund (rog@charlott.no)
Date:02/11/2004 07:21:58 AM
List:com.mysql.lists.mysql

* Carlos Vazquez

I get this error when I try to execute the following select statement: "All Parts of a PRIMARY KEY must be NOT NULL; if you need null in a key, use UNIQUE instead."

CREATE TEMPORARY TABLE IF NOT EXISTS CashVariances (PRIMARY KEY(sUnit)) SELECT sUnit, dSalesDate AS dDate, SUM(nStoreCash) AS aCash, SUM(nBankCash) AS bCash, SUM(nStoreCash) - SUM(nBankCash) AS nDifference FROM CashBalances

Is the sUnit column defined as NOT NULL in the CashBalances table? It should be.