I am attempting to sort on two fields, first one then the other. When I add two fields in the "sort and group results" tab, it doesnt seem to want to sort properly. When looking at the SQL code, it seems as if it is using one field for both sort requests... for example, this one looks like it should be "ORDER BY 1,6" but it comes out 6,6 instead. If I manually edit the SQL and change it to 1,6, it works the way I want it to.
here is the sql
SELECT ALL; ML.DATE AS DATE_M,; ML.SA_NAME AS SA_NAME_M,; ML.SA_SS AS SA_SS_M,; ML.CITY AS CITY_M,; ML.ST AS ST_M,; ML.SPON_NAME; FROM "ML" ML; INTO CURSOR JAPPS; WHERE (ML.DATE BETWEEN {^2008-03-01} AND {^2008-05-04}); ORDER BY 6, 6
** (ORDER BY with field names)...** ORDER BY DATE_M, ST_M
My bad, it should say "problem with ORDER by"
I just built a query which ended up with the following SQL:
SELECT ALL; Orders.DATE AS DATE_O,; Orders.ORD_NO AS ORD_NO_O,; Lines.ITEM AS ITEM_L,; Lines.DESC AS DESC_L,; Lines.QUANT AS QUANT_L,; Orders.SA_SS AS SA_SS_O,; Orders.SA_NAME AS SA_NAME_O,; Orders.ST AS ST_O; FROM "ML-ORDER" Orders,; "ML-LINE" Lines; INTO CURSOR JLINESALL; WHERE (Orders.ORD_NO = Lines.ORD_NO) AND (ORDERS.DATE>={^2007-09-01}; AND LINES.ITEM BETWEEN "CARM" AND "CARMX"); ORDER BY 8
** (ORDER BY with field names)...** ORDER BY SA_SS_O
Which should be ORDER BY 6. When I went to the "Select Data Items" tab, and moved Orders.SA_SS down to position 8, the SQL corrected itself to say BY 6, and didnt change the position of the Orders.SA_SS line... but ran fine... when I moved the line back to position 6, the SQL code stayed correct and still runs fine....
I am running build 8.1.559