Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
View SQL Parsing Problem
Message
De
30/10/1998 15:54:39
Rick Hawkins
Rose Valley Software Studio
Wallingford, Pennsylvanie, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00151526
Message ID:
00153029
Vues:
31
Hi David,

I really appreciate all your help.
First of all , I am not aware that OR takes precedence over AND

I created a view using PRG code that looks like this:

CREATE SQL VIEW request A AS;
SELECT * FROM A;
WHERE Request.USER_CLOCK LIKE ?cuser_clock;
AND Request.AREA LIKE ?carea;
AND (Request.MNRCAT LIKE ?cmnrcat OR Request.MNRCAT IS NULL);
AND (Request.STATUS LIKE ?cstatus OR Request.STATUS IS NULL);

Then I went to view desinger and checked the SQL from 'SQL Syntax' menu. It looked like this.

SELECT * from A
WHERE Request.USER_CLOCK LIKE ?cuser_clock;
AND Request.AREA LIKE ?carea;
AND Request.MNRCAT LIKE ?cmnrcat;
OR (Request.MNRCAT IS NULL;
AND Request.STATUS LIKE ?cstatus);
OR (Request.STATUS IS NULL;

** Notice the position of ( and )

Thanks

>Rick,
>
>CREATE SQL VIEW request A AS;
> SELECT * FROM A;
> WHERE Request.USER_CLOCK LIKE ?cuser_clock;
> AND Request.AREA LIKE ?carea;
> AND (Request.MNRCAT LIKE ?cmnrcat OR Request.MNRCAT IS NULL);
> AND (Request.STATUS LIKE ?cstatus OR Request.STATUS IS NULL);
>
>I don't understand how it can not be getting the () where you place them. I assumed since you were originally talking about the view designer that you looked at it. When you mentioned that you saw the () out of place, where exactly did you see that?
>
>I assume you know that OR has precedence over AND which is why you enclosed the two OR expressions.
>
>Looking closer at the view I think it ought to be:
>
>CREATE SQL VIEW request AS;
> SELECT * FROM A;
> WHERE A.USER_CLOCK LIKE ?cuser_clock;
> AND A.AREA LIKE ?carea;
> AND (A.MNRCAT LIKE ?cmnrcat OR A.MNRCAT IS NULL);
> AND (A.STATUS LIKE ?cstatus OR A.STATUS IS NULL)
>
>
>>I have the view code in a prg. I am not trying to edit it from view designer after it is created from the code. I dont know where to place () i.e brackets for AND and OR. I want your help with that.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform