Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code this in one select
Message
 
 
To
19/06/2006 19:41:40
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01130101
Message ID:
01130117
Views:
14
There's a typo in the query.
   AND mm.state = mm.state 
* should be
   AND xx.state = mm.state 
* or
  AND xx.state = tcState ;
* The following query works in VFP8. I don't have VFP6 to test
SELECT * FROM myTable mm ;
	WHERE mm.ctrl = tnCtrl ;
		AND mm.state = tcState ;
		AND NOT mm.deleted ;
   		AND mm.version = ( ;
 			SELECT MAX(version)  ;
			  FROM myTable xx ;
			  WHERE xx.ctrl = mm.ctrl ;
				AND xx.state = mm.state ;
				AND xx.version <= tnVersion )
* or
...
			  WHERE xx.ctrl = tnCtrl ;
				AND xx.state = tcState ;
				AND xx.version <= tnVersion )
>Thanks for trying but this needs to run in VFP 6. I get "Error correlating fields" (I get the same error in VFP 8.) I also modified it to meet the requirement that it check only records at or below the specified version.
>
>SELECT * FROM myTable mm ;
>   WHERE mm.ctrl = tnCtrl ;
>     AND mm.state = tcState ;
>     AND NOT mm.deleted ;
>     AND mm.version = ( ;
>                       SELECT MAX(version) ;
>                         FROM myTable xx ;
>                        WHERE xx.ctrl = mm.ctrl ;
>                          AND xx.version <= tnVersion
>                          AND mm.state = mm.state )
>
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform