>Hello,
>
>Can anyone tell me how to better write the following SELECT:
>
>SELECT a.def_id, a.casenumber, a.vlastname, a.vfirstname, a.arrestnum, a.codenum, ;
>a.arrestdate, a.arresttime, b.lname, b.fname ;
>FROM defendan a, Person_a b ;
>WHERE a.arrestnum = b.arrestnum AND a.casenumber = m.case ;
>ORDER BY lname, fname ;
>INTO CURSOR lctest
>
>This is in a FPW 2.6 application. It works fine on some machines, but creates an ICE on other machines. On some machines, it works fine for a while, then creates an ICE. Once it creates an ICE, I can not get the SQL to work again without getting the ICE.
>
>I have traced the problem to the ORDER BY clause. If I remove the ORDER BY, the ICE does not occur.
So split it into two:
SELECT a.def_id, a.casenumber, a.vlastname, a.vfirstname, a.arrestnum, a.codenum, ;
a.arrestdate, a.arresttime, b.lname, b.fname ;
FROM defendan a, Person_a b ;
WHERE a.arrestnum = b.arrestnum AND a.casenumber = m.case ;
INTO CURSOR lctest1
SELECT * from lctest1 into curs lctest ;
ORDER BY lname, fname
If this is still too heavy, you can first select from defendan ... where a.casenumber = m.case into a first cursor, then join the results with the person_a, then order it in the third SQL. A spoonful at a time.