Rob,

You cannot "SELECT" a column (storeno) that you don't also GROUP BY, if you
have a GROUP BY in a SELECT.

Does your list make sense if you do it this way? (Do workord's duplicate
across stores?)

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

Bill

On 12/20/07, Rob Vincent <[EMAIL PROTECTED]> wrote:
>
>  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