Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement