Rewriting won't correct logic assumption errors
(that your data will match the query)
But here it is
(all lines below are on 1 line!)
SELECT * FROM Results WHERE
(Name='::SelectName::' AND Activity='::SelectActivity::' AND Purpose='::SelectPurpose::')
OR (Name='::SelectName::' AND Activity='::SelectActivity::')
OR (Name='::SelectName::' AND Purpose='::SelectPurpose::')
Test each condition separately
For the 1st one just use
SELECT * FROM Results WHERE
(Name='::SelectName::' AND Activity='::SelectActivity::' AND Purpose='::SelectPurpose::')
--
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________
| Thanks Stefan,
|
| However I'm obviously still doing something wrong as I still can't get it to
| work. Can you re-write my original query for me, so I know how it should read?
|
| Thanks
|
| "Stefan B Rusynko" wrote:
|
| > Logic error
| > - make your 3rd condition the 1st condition
| >
| > In any select with OR the 1st criteria met will yield the results
| > (even if any further tests could also yield results)
| > And the results are determined from left to right
| > (so the 1st test that fails, yields an F, determines the test result)
| > - in your case test 1 and test 2 already have determined the results of test 3 before it is even seen
| > Look at your code as simple Boolean tests
| > - below is annotated w/ simple results as XtestT/F meaning results of comparison are True or False
| >
| > SELECT * FROM Results
| > WHERE
| > (Name='::SelectName::' AND Activity='::SelectActivity::')
| > (NtestT/F and AtestT/F) which yields T OR F (test1) - say T
| > OR
| > (Name='::SelectName::' AND Purpose='::SelectPurpose::')
| > (NtestT/F and PtestT/F) which yields T OR F (test2) - say T
| > OR
| > (Name='::SelectName::' AND Activity='::SelectActivity::' AND Purpose='::SelectPurpose::')
| > (NtestT/F and AtestT/F and PtestT/F)
| > is the same as ( test1T/F and PtestT/F ) which yields T OR F (test 3)
| > - and by this time either test1 or test2 has yielded T so they would have been selected for results
| > (or if test1 has yielded F, test 3 will always yield F)
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > To find the best Newsgroup for FrontPage support see:
| >
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
| > _____________________________________________
| >
| >
| > |I have written a Custom Query using the Database Results Wizard as follows:
| > |
| > | SELECT * FROM Results WHERE (Name = '::SelectName::' AND Activity =
| > | '::SelectActivity::') OR (Name = '::SelectName::' AND Purpose =
| > | '::SelectPurpose::') OR (Name = '::SelectName::' AND Activity =
| > | '::SelectActivity::' AND Purpose = '::SelectPurpose::')
| > |
| > | The first two parts of this work fine and return the correct results if only
| > | two criteria option are selected, however when all three criteria selection
| > | are selected the the results returned are incorrect, it seems to only
| > | recognise and match the Name part.
| > |
| > | Any ideas?
| >
| >
| >