Re: Wierd INSERT ... SELECT syntax problem

2008-09-06 Thread Brent Baisley
Well, for your simple example, you can use query variables to add the counters. SET @cntr:=0, @lastVal:='A' INSERT INTO tableB LOC,DATA SELECT CONCAT(LOC, CONCAT( IF(@lastVal=LOC, @cntr:[EMAIL PROTECTED], @cntr:=0), IF(@lastVal:=LOC,'',''))) LOC, CONCAT(DATA, @cntr) FROM tableA ORDER BY

Re: Wierd INSERT ... SELECT syntax problem

2008-09-06 Thread Dan Tappin
Thanks for the tip. I am looking at just making 16 separate queries. It will be easier to manage and faster to run. Dan On Sep 6, 2008, at 9:37 PM, Brent Baisley [EMAIL PROTECTED] wrote: Well, for your simple example, you can use query variables to add the counters. SET @cntr:=0,

Wierd INSERT ... SELECT syntax problem

2008-09-05 Thread Dan Tappin
I have an existing data set - here is an example (the real one is more complex than this) LOC DATA - A 1 B 2 C 3 D 4 E 5 F 6 ... and I am looking to run some sort of INSERT ... SELECT on this to make a new table like this: LOC