Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with LEFT JOIN
Message
De
20/01/2005 10:28:45
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00978845
Message ID:
00978876
Vues:
28
>Hi everybody,
>
>I have a view which I am trying to use in the Search form. Here is a view definition:
>
>(BTW, why View designer puts "(" this strange way and how can I fix it?)
>
>I want to be able to search by any of the field. The patient may not have Phones, hence the LEFT JOIN and IS NULL clause. However, if I'm searching by Phone, this view returns empty records as well, which I do not need. I can modify my OR condition to OR (vp_cAreaCode="%" and Phones.cArea_Code IS NULL), but I do not know, if this is a "kosher" approach? Anyone has a better advice for me?

The parenthesis are to keep its order of operations straight. You do need to be careful with them and OR conditions to be sure you receive the correct results.
When I have optional parameters, they're usually to filter the result set, so not sending that parameter would have no effect. The WHERE clause in that case looks like IIF(EMPTY(?vp_optional, .T., table.optional = ?vp_optional). I don't use NULLs, but you should be able to adapt that for them.

Chris.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform