> * Grab the unique listing
> SELECT DISTINCT desc ;
> FROM myTable ;
> INTO CURSOR cDescList
> * Build it (if it gets to be too big, you'll have to do it programmatically)
> lcSql = "SELECT flatNo,name,"
> lcSql = lcSql + ",SUM(IIF(desc = '" + cDescList.desc + "', amt, 00000.00)) as amt" + ALLTRIM(STR(RECNO('cDescList'),3,0)
> * Append the tail
> lcSql = lcSql + " FROM myTable GROUP BY 1, 2 INTO CURSOR c_output"
> * Execute it