INSERT INTO exception SELECT storeno FROM invhist WHERE DATESRVC BETWEEN .sdate 
AND .edate GROUP BY storeno HAVING COUNT(WORKORD) > 1

You had the group column wrong.
In addition I think you will see better performance with BETWEEN for the dates

Dennis McGrath
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Rob Vincent
Sent: Thursday, December 20, 2007 2:03 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - GROUP BY .. HAVING

Greetings R-List,

I've got a command line that isn't working.
The following command should insert a store number into an exception table if a 
duplicate work order number exists in a history file.

INSERT INTO exception SELECT DISTINCT storeno FROM invhist WHERE DATESRVC >= 
.sdate AND DATESRVC <= .edate GROUP BY WORKORD HAVING COUNT(WORKORD) > 1

The table 'exception' has 1 column named 'storeno'
The table 'invhist' has 10,000+ rows with a columns: storeno, workord, datesrvc 
(and others)

I'm getting an error message stating "llegal Column specification (2512)"

Any pointers would be welcomed!

Rob Vincent

Reply via email to