Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IN or NOT IN (causes C5)
Message
 
 
To
17/03/2004 11:41:57
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00887116
Message ID:
00887122
Views:
15
This message has been marked as the solution to the initial question of the thread.
Chris,

Try
SELECT OrderID FROM Orders ;
  WHERE (vp_ItemID < 0 AND  Orders.OrderID NOT IN ;
           (SELECT OrderID FROM LineItems ;
               WHERE LineItems.ItemID = ABS(?vp_ItemID)))  ;
	OR ;
  	(vp_ItemID >= 0 AND Orders.OrderID IN ;
           (SELECT OrderID FROM LineItems ;
    	     WHERE LineItems.ItemID = ?vp_ItemID))  
>I have a query where the view parameter is used to generate a subquery:
>
>
>SELECT OrderID FROM Orders ;
> WHERE Orders.OrderID IN ;
> (SELECT OrderID FROM LineItems ;
>  WHERE LineItems.ItemID = ?vp_ItemID)
>
>
>This works just fine, but I want to be able to supply whether vp_ItemID is IN/NOT IN the subquery. After multiple attempts, many of them causing C5s, I'm here looking for a way to accomplish this.
>
>
>The following code in the View Designer causes a C5 on VFP8 SP1/Win2K SP4.
>
>SELECT OrderID FROM Orders ;
>  WHERE IIF(vp_ItemID < 0, ;
>  Orders.OrderID NOT IN ;
>    (SELECT OrderID FROM LineItems ;
>     WHERE LineItems.ItemID = ABS(?vp_ItemID)), ;
>  Orders.OrderID IN ;
>    (SELECT OrderID FROM LineItems ;
>     WHERE LineItems.ItemID = ?vp_ItemID) )
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform