A SQL Select may create a filter cursor, but not when you join other data. To check, see what DBF("result_a") is. If it's the name of one of the involved tables it's a filter cursor. It'll most probably be a tmp file name. (by the way, a minus sign in a name is not allowed).
Your new workarea is neither tableA nor any of the joined tables, you create a new cursor, a temp dbf. It has a separate record pointer and points at the top.
You still should stay on whatever record in tableA, because SQL always opens up its own workareas not only for the query result but also the source tables. Therefore SQL will also not take into account any filters you set on tableA or any other things in effect for the tableA workarea. Since you query from an already opened workarea, to get at the source, the SQL engine will determine DBF("tableA"), reopen that and query
To illustrate the principle, Mike has already given code. This here is self-contained and doesn't depend on your data.
Code:
Close Tables All
Clear
Create Cursor crsTest (id int)
Insert into crsTest values (1)
Insert into crsTest values (2)
Insert into crsTest values (3)
Goto 2 in crsTest
Create Cursor crsTest2 (id int)
Insert into crsTest2 values (3)
Insert into crsTest2 values (4)
Insert into crsTest2 values (5)
Select *, Alias() from crsTest inner join crsTest2 on crsTest.id=crsTest2.id into cursor crsResult
? "record ", Recno("crsTest"), "in crsTest, workarea no", Select("crsTest")
? "record ", Recno("crsTest2"), "in crsTest2, workarea no", Select("crsTest2")
? "record ", Recno("crsResult"), "in crsResult, workarea no", Select("crsResult")
after you run this you'll see crsTest and crsTest2 will be using workareas 1 and 2. Both record pointers are where they already were before the SQL. Tha alias name within the crsResult will be "C"m which is the name the SQL engine will give to something it opens in workarea 3. And the crsResult will be in workarea 6, which indicates the SQL engine also used workareas 4 and 5, but the final result is created in workarea 6.
And this is even so, despite the sources not being permanent DBFs, the SQL engine does not interfere with any already used workarea, It'll use its own workareas and put the result into a new workarea, too.
More things that may play a role are tablebuffering, if you only use record buffering and move off a record, that triggers a tableupdate of that left record and within that update/delete triggers run and may do anything.
Bye, Olaf.
Olaf Doschke Software Engineering