Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Difficulty writing SQL Statement
Message
 
 
To
07/01/2009 21:21:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01371924
Message ID:
01371940
Views:
14
>Ah. Correct.
>But, I still get the wrong record set.
>The only way I can get it not to give me the wrong set of group records are to change it as so:
>
>select rule.* from rule INNER JOIN users on rule.cuserid = users.cid where Users.cID = ?vp_cuserid ;
>UNION all;
>select rule.* from rule INNER JOIN users on rule.cgroupid = users.cgroupid where Users.cID = ?vp_cuserid and rule.cgroupid <> "ZZZZZZ"
>
>
>But is this an incorrect way to try to accomplish this?

Another query to try
select * from rule 
  WHERE cuserid = ?vp_cuserid
	OR cgroupid IN ( SELECT cgroupid FROM Users WHERE cID = ?vp_cuserid AND cgroupid <> "ZZZZZZ" )
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform