VFP alters my query! (newbie question)
Author |
Message |
atir.. #1 / 13
|
VFP alters my query! (newbie question)
Hi! Here is my problem : I write the following query in Visual Foxpro (v. 5.0) : SELECT Nurita.no, Nurita.name, Nurita.achzaka, Nurita.support,; Nurita.beamd, Nurita.barplt; FROM nurit!nurita; WHERE Nurita.support IN ("atir"); AND (!empty(nurita.beamd).or.!empty(nurita.barplt)) = .T.; ORDER BY Nurita.name In the SQL , I see the above , then I exit and save. When I reenter , the query has changed to the following : (the difference is in the 5th line!) SELECT Nurita.no, Nurita.name, Nurita.achzaka, Nurita.support,; Nurita.beamd, Nurita.barplt; FROM nurit!nurita; WHERE Nurita.support IN ("atir"); AND .NOT.EMPTY(Nurita.beamd).OR..NOT.EMPTY(nurita.barplt)) = .T.; ORDER BY Nurita.name which naturally gives me different results! Any ideas ? If it is no bother , please e-mail me the answer (in addition to posting the answer in the newsgroup). Thanks, Nurit
|
Sat, 14 Oct 2000 03:00:00 GMT |
|
|
Myron Kirb #2 / 13
|
VFP alters my query! (newbie question)
The second one would give an error for un-matched parenthesis's. I am not sure what you are saying is changing it. I entered the top query using MODI COMM TestIt and saved it and then re-entered it. There were no automatic changes. -myron kirby-
==========================
Quote: >Hi! > Here is my problem : > I write the following query in Visual Foxpro (v. 5.0) : > SELECT Nurita.no, Nurita.name, Nurita.achzaka, Nurita.support,; > Nurita.beamd, Nurita.barplt; > FROM nurit!nurita; > WHERE Nurita.support IN ("atir"); > AND (!empty(nurita.beamd).or.!empty(nurita.barplt)) = .T.; > ORDER BY Nurita.name > In the SQL , I see the above , then I exit and save. > When I reenter , the query has changed to the following : > (the difference is in the 5th line!) > SELECT Nurita.no, Nurita.name, Nurita.achzaka, Nurita.support,; > Nurita.beamd, Nurita.barplt; > FROM nurit!nurita; > WHERE Nurita.support IN ("atir"); > AND .NOT.EMPTY(Nurita.beamd).OR..NOT.EMPTY(nurita.barplt)) = .T.; > ORDER BY Nurita.name > which naturally gives me different results! >Any ideas ? >If it is no bother , please e-mail me the answer (in addition to >posting the answer in the newsgroup). >Thanks, > Nurit
|
Sat, 14 Oct 2000 03:00:00 GMT |
|
|
Donald Orphanidy #3 / 13
|
VFP alters my query! (newbie question)
I may be missing something here but, are you sure that you are getting different results? The statements look the same to me. The ! and .NOT. are the same thing. -- Donald
o __o <|v _`\<; _________/_>___(*)/(*)________________ Sooner or later, all players become spectators
Quote: >Hi! > Here is my problem : > I write the following query in Visual Foxpro (v. 5.0) : > SELECT Nurita.no, Nurita.name, Nurita.achzaka, Nurita.support,; > Nurita.beamd, Nurita.barplt; > FROM nurit!nurita; > WHERE Nurita.support IN ("atir"); > AND (!empty(nurita.beamd).or.!empty(nurita.barplt)) = .T.; > ORDER BY Nurita.name > In the SQL , I see the above , then I exit and save. > When I reenter , the query has changed to the following : > (the difference is in the 5th line!) > SELECT Nurita.no, Nurita.name, Nurita.achzaka, Nurita.support,; > Nurita.beamd, Nurita.barplt; > FROM nurit!nurita; > WHERE Nurita.support IN ("atir"); > AND .NOT.EMPTY(Nurita.beamd).OR..NOT.EMPTY(nurita.barplt)) = .T.; > ORDER BY Nurita.name > which naturally gives me different results! >Any ideas ? >If it is no bother , please e-mail me the answer (in addition to >posting the answer in the newsgroup). >Thanks, > Nurit
|
Sat, 14 Oct 2000 03:00:00 GMT |
|
|
Dave Leig #4 / 13
|
VFP alters my query! (newbie question)
Quote:
> Hi! > Here is my problem : > I write the following query in Visual Foxpro (v. 5.0) : > SELECT Nurita.no, Nurita.name, Nurita.achzaka, Nurita.support,; > Nurita.beamd, Nurita.barplt; > FROM nurit!nurita; > WHERE Nurita.support IN ("atir"); > AND (!empty(nurita.beamd).or.!empty(nurita.barplt)) = .T.; > ORDER BY Nurita.name > In the SQL , I see the above , then I exit and save. > When I reenter , the query has changed to the following : > (the difference is in the 5th line!) > SELECT Nurita.no, Nurita.name, Nurita.achzaka, Nurita.support,; > Nurita.beamd, Nurita.barplt; > FROM nurit!nurita; > WHERE Nurita.support IN ("atir"); > AND .NOT.EMPTY(Nurita.beamd).OR..NOT.EMPTY(nurita.barplt)) = .T.; > ORDER BY Nurita.name > which naturally gives me different results! > Any ideas ? > If it is no bother , please e-mail me the answer (in addition to > posting the answer in the newsgroup). > Thanks, > Nurit
I would write the clause as "AND (.NOT.empty(nurita.beamd).or. .NOT.empty(nurita.barplt)) " in the first place. Leave off the "=.T.", it's redundant. -- Dave
|
Sun, 15 Oct 2000 03:00:00 GMT |
|
|
atir.. #5 / 13
|
VFP alters my query! (newbie question)
Hi again! Thanks for all your replies! Unluckily , I goofed up a bit in my initial post , and thanks to the combination of cut and paste and my inattention , have left a parenthesis where there shouldn't have been one... The fourth and fifth lines in the resulting query should have read : "WHERE Nurita.support IN ("atir") AND .NOT.EMPTY(Nurita.beamd).OR..NOT.EMPTY(nurita.barplt) = .T.;" , which definitely is not the same as "WHERE Nurita.support IN ("atir") AND (!empty(Nurita.beamd).or.!empty(nurita.barplt)) = .T.;" Any ideas? Many thanks, Nurit
|
Sun, 15 Oct 2000 03:00:00 GMT |
|
|
Christopher A. Re #6 / 13
|
VFP alters my query! (newbie question)
Quote:
>Hi again! >Thanks for all your replies! >Unluckily , I goofed up a bit in my initial post , and thanks to the >combination of cut and paste and my inattention , have left a >parenthesis where there shouldn't have been one... >The fourth and fifth lines in the resulting query should have read : >"WHERE Nurita.support IN ("atir") > AND .NOT.EMPTY(Nurita.beamd).OR..NOT.EMPTY(nurita.barplt) = .T.;" , >which definitely is not the same as >"WHERE Nurita.support IN ("atir") > AND (!empty(Nurita.beamd).or.!empty(nurita.barplt)) = .T.;"
I am assuming the differences between these two statements is that the second is what you actually typed and the first is what the Query Designer produced. If this is true, my first piece of advice is to avoid the Query Designer. If you are creating complex filters (yes, the above WHERE is complex for the Query Designer), then you should avoid using the Query Designer. If this is not on the right track, please respond further to this thread with more clarification. Christopher Reed
"The oxen are slow, but the earth is patient."
|
Sun, 15 Oct 2000 03:00:00 GMT |
|
|
David Frankenbac #7 / 13
|
VFP alters my query! (newbie question)
Anders, Not quite, the precedence of AND over OR make your first two expressions not equivalent, the ( ) are needed to get the OR to be evaluated before the AND. The original expression was X (!Y + !Z ) which is equivalent to X !(YZ) using DeMorgan's Theorem, but VFP wasn't quite doing that either. I think the view designer is just incapable of handling (). df - (Microsoft FoxPro MVP) http://www.geocities.com/ResearchTriangle/9834/ Quote:
>Zahid >Are they really identical. Consider this example: >x = .t. >y = .f. >z = .f. >? x and (not y or not z) >? x and not y or not z >? x and (not y and z) >? x and not y and z >.T. >.T. >.F. >.F.
|
Mon, 16 Oct 2000 03:00:00 GMT |
|
|
David Frankenbac #8 / 13
|
VFP alters my query! (newbie question)
Zahid, I don't know how you got the original parens into the where clause to begin with using the view designer (VD). The VD is pretty limited in the types of views it can build. Just do this view in code and use the CREATE SQL VIEW command to get it stored in the database. df - (Microsoft FoxPro MVP) http://www.geocities.com/ResearchTriangle/9834/ Quote:
>Anders ... >The examples you gave do not reflect what I said, which was that: > x and not (y and z) >is equivalent to > x and (not y or not z)
|
Wed, 18 Oct 2000 03:00:00 GMT |
|
|
|