Thanks Fred I now encounter a problem with the "group and order by"
Original goes like this (no problem but I want to refine it) *Select client,"CL"+Upper(Left(Cmonth(invdate),3)), Sum(Iif(trantype='I',ttlamount-(ttlamount*(ppb/100)),ttlamount*-1)) ; *FROM winhst Where Between(saleperiod,psdate1,psdate2) And trantype $ "CI" And client=windebs.Code Group By 1,2 Order By 1,2 Into Table &myfile Select client,"CL"+UPPER(LEFT(CMONTH(DATE(INT(saleperiod/100),saleperiod-(INT(saleperiod/100)*100),1)),3)), Sum(Iif(trantype='I',ttlamount-(ttlamount*(ppb/100)),ttlamount*-1)) ; FROM winhst Where Between(saleperiod,psdate1,psdate2) And trantype $ "CI" And client=windebs.Code Group By 1,2 Order By 1,2 Into Table &myfile This causes a problem on the group and order by If I group and order by 1 its ok On Thu, Mar 19, 2009 at 12:53 PM, Fred Taylor <[email protected]> wrote: > Here's one way: > > ?CMONTH(EVALUATE("{^"+"yyyy"+"/"+"mm"+"/01}")) > > convert your year and month as needed to character or if they're numeric: > > ?CMONTH(DATE(yyyy,mm,1)) > > > On Wed, Mar 18, 2009 at 4:37 PM, Sytze de Boer <[email protected]> wrote: > > > Hi > > > > I know how to do cmonth(date()) and various derivatives thereof > > How do convert a number to a month ? > > > > This is be done in a select statement where 1 field is (say 200804 or > > 200805) > > The numbers are consistent yyyy mm, and I'm only concerned with the month > > > > I appreciate all pointers > > > > -- > > Regards > > Sytze de Boer > > Kiss Systems > > Hamilton, NZ > > Ph: 64-7-8391670, Mob:021 937611, > > www.kiss.co.nz > > > > > > --- StripMime Report -- processed MIME parts --- > > multipart/alternative > > text/plain (text body -- kept) > > text/html > > --- > > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

