Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What's wrong with this SELECT?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00025329
Message ID:
00025362
Views:
29
>>>>I have a table (named test) with a structure like this:
>>>>
>>>>ObjectID n 6
>>>>ParentID n 6
>>>>Description c 20
>>>>...
>>>>
>>>>ParentID refere to other ObjectID in the same table.
>>>>
>>>>I want to select all ObjectID who have there Parent deleted to delete them to.
>>>>
>>>>In my program i delete an item in the test table and, after that, i run this select:
>>>>
>>>>SELECT test.ObjectID ;
>>>>FROM Test ;
>>>>WHERE test.ParentID IN ;
>>>>(SELECT Test.ObjectID FROM Test WHERE DELETED() = .T.);
>>>>INTO CURSOR ToDel
>>>>
>>>>Nothing is returned!
>>>>What's wrong?
>>>
>>>I'm not strong in SELECT SQL but:
>>>1. Do you have SET DELETED ON or OFF? It must be OFF.
>>>2. DELETED() returns already a logical value. So, no need to test DELETED() = .t.
>>>3. Try:
>>>
>>>SELECT ObjectID ;
>>>FROM Test t1;
>>>WHERE (not DELETED()) and (t1.ParentID IN ;
>>>(SELECT ObjectID FROM Test t2 WHERE DELETED()));
>>>INTO CURSOR ToDel
>>>
>>>Vlad
>>
>>SET DELETED is OFF
>>

>>I add the "= .T." to keep the SELECT more readable.
>>
>>I tryed your's but nothing is returned!
>>
>>What's wrong?
>
>Gerald: Why don't you break it into steps and check out each step
>
>1. Set deleted off && all records will be seen
>
>2. SELECT ObjectID FROM Test WHERE DELETED() into cursor temp1
>
>3. BROW && Now you can see if you have any OBJECT IDs deleted
>
>4. SELECT OBJECTID from test, temp1 where TEST.parentid = temp1.objectid into cursor MyCursor
>
>5. BROW && Now you can see if there was any overlap.
>
>Maybe you can see if there's REALLY no data (no deleted records?) or some other problem will become more obvious.
>
>HTH
>Barbara

Of course, i already do this and it's work.
Yes, like i write up there, at least one record is deleted.

But my question remains the same...

What is wrong with this SELECT???

It's became an "existential" question. ;-]
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform