Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditional select statement
Message
From
28/02/2006 11:16:08
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01099679
Message ID:
01099926
Views:
19
>Hi Fabio,
>
>I forgot to mention that join to Groups is derived, e.g. first I have to join to UsGrLink table. I guess, I would probably have to go with two separate paths depending on class property (e.g. I can add some property like lTransferAccounts, that would be true for the second case).
>

Where is the problem ? LEFT JOIN is ignored if ON return a NULL.
Is the problem into the projection fields list ?
Post the two versions wished.

>>>Hi everybody,
>>>
>>>I have a queue assignment form that allows to get accounts from UNASSIGNED queue or from a particular investigator.
>>>
>>>In the first case one of the condition will look like:
>>>
>>>and Trans_Employees_Queues.cCommission_Owner_UsGrLink_fk IS NULL, in the other case the condition would be
>>>Trans.cCommissioned_Owner = m.tcUserID
>>>
>>>Now, in the second case I'd like to join to another table (Groups) and get some fields from it. How can I make this generic, e.g. my routine doesn't know which type of WHERE condition I'm passing (I'm just passing lcWhereStr) for my select statement? In other words, I want to join with Groups table if cCommission_Owner_UsGrLink_fk is not null, otherwise I want to just put null placeholders instead of the fields.
>>>
>>>Thanks in advance.
>>
>>
>>...
>>LEFT JOIN Groups ON join condition AND cCommission_Owner_UsGrLink_fk IS NOT NULL
>>WHERE ....
>>
>>* PROBABLY
>>...
>>LEFT JOIN Groups ON Groups.somefield=Trans_Employees_Queues.cCommission_Owner_UsGrLink_fk
>>WHERE ...
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform