[AccessD] Query question

David McAfee davidmcafee at gmail.com
Wed Jun 2 17:33:55 CDT 2010


Chester, if you take the WHERE caluse out, how many records do you get? 100?

If so, then it is because of the "True = -1" and that would mean
returning only 4 records is correct.


On Wed, Jun 2, 2010 at 3:08 PM, David McAfee <davidmcafee at gmail.com> wrote:
> This is true.
>
> Chester , what happens if change the WHERE clause to the following:
>
> WHERE  ([Design_Fluid_Status_Id]='WI' AND ([Status]='WAGC' OR [Status]='CI'))
>        OR ([Design_Fluid_Status_Id]='CI' AND ([Status]='WAGW' OR [Status]='WI'))
>
>
>
> On Wed, Jun 2, 2010 at 2:53 PM, Fred Hooper <fahooper at trapo.com> wrote:
>> Agreed, weird. I guess it comes down to what's right: 100 or 4 records?
>>
>> On 6/2/2010 5:07 PM, David McAfee wrote:
>>> That's so weird. It's basically saying WHERE True = -1   or WHERE False =-1
>>>
>>> On Wed, Jun 2, 2010 at 1:55 PM, Kaup, Chester
>>> <Chester_Kaup at kindermorgan.com> wrote:
>>>
>>>> Apparently something else is going on because without the -1 I get 100 records and with it 4 records. If I look at the results each record returns a 0 or 1.
>>>>
>>>> -----Original Message-----
>>>> From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Fred Hooper
>>>> Sent: Wednesday, June 02, 2010 3:19 PM
>>>> To: Access Developers discussion and problem solving
>>>> Subject: Re: [AccessD] Query question
>>>>
>>>> Hi Chester,
>>>>
>>>> It looks like "-1" is a synonym for True, and therefore redundant in a Where clause as nothing would be returned unless the Where clause were True
>>>> WHERE (
>>>> (([Status]='WAGC' And [Design_Fluid_Status_Id]='WI')
>>>> Or ([Status]='WAGW' And [Design_Fluid_Status_Id]='CI')
>>>> Or ([Status]='CI' And [Design_Fluid_Status_Id]='WI')
>>>> Or ([Status]='WI' And [Design_Fluid_Status_Id]='CI'))
>>>> =-1)
>>>>
>>>> This would do the same thing:
>>>> WHERE
>>>> (([Status]='WAGC' And [Design_Fluid_Status_Id]='WI')
>>>> Or ([Status]='WAGW' And [Design_Fluid_Status_Id]='CI')
>>>> Or ([Status]='CI' And [Design_Fluid_Status_Id]='WI')
>>>> Or ([Status]='WI' And [Design_Fluid_Status_Id]='CI'))
>>>>
>>>> Fred Hooper
>>>>
>>>> On 6/2/2010 3:13 PM, Kaup, Chester wrote:
>>>>
>>>>
>>>>> This is part of a query that someone gave me. I am not sure what it is really doing. I am thinking it returns a value of -1 if any of the conditions are true. Is that correct? I have not in my limited experience see anything like this before. Is this the best way to do this? Thanks
>>>>>
>>>>> WHERE ((([Status]='WAGC' And [Design_Fluid_Status_Id]='WI')
>>>>> Or ([Status]='WAGW' And [Design_Fluid_Status_Id]='CI')
>>>>> Or ([Status]='CI' And [Design_Fluid_Status_Id]='WI')
>>>>> Or ([Status]='WI' And [Design_Fluid_Status_Id]='CI'))=-1)
>>>>>
>>>>>
>>>>> Chester Kaup
>>>>> Engineering Technician
>>>>> Kinder Morgan CO2 Company, LLP
>>>>> Office (432) 688-3797
>>>>> FAX (432) 688-3799
>>>>>
>>>>>
>>>>> No trees were killed in the sending of this message. However a large number of electrons were terribly inconvenienced.
>>>>>
>>>>>
>>>>>
>>>>>
>>>> --
>>>> AccessD mailing list
>>>> AccessD at databaseadvisors.com
>>>> http://databaseadvisors.com/mailman/listinfo/accessd
>>>> Website: http://www.databaseadvisors.com
>>>>
>>>>
>>>> --
>>>> AccessD mailing list
>>>> AccessD at databaseadvisors.com
>>>> http://databaseadvisors.com/mailman/listinfo/accessd
>>>> Website: http://www.databaseadvisors.com
>>>>
>>>>
>>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>




More information about the AccessD mailing list