Results 1 to 6 of 6

Thread: access 2k2 query problem

  1. #1
    Join Date
    Aug 2003
    Posts
    7

    access 2k2 query problem

    hi,
    i am currently using MS access 2002 and i have a problem regarding the following table...

    *Name *Item Number
    --------------------------------------------
    john ball
    john watch
    john computer
    john telephone


    *Primary key

    The whole of number column is empty, and the primary key is Name and Item.
    i wanted to select all the rows except for, say, the first row...

    i use the following query string:

    SELECT * FROM table1 WHERE Name<>'john' AND Item<>'ball';

    the result return nothing, why is that so??

    thz in advance
    Last edited by 0133892; 08-01-2003 at 01:28 AM.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    That's because Name<>'john' condition eliminates all rows.

    Try

    SELECT * FROM table1 WHERE Name<>'john' OR Item<>'ball';

  3. #3
    Join Date
    Aug 2003
    Posts
    7
    i tried that before and it fail...
    using the OR operator would mean that EITHER one of the condition is true will return the row.. and name<>'john' would result in all row being false, and nothing gets return...

    basically, using the AND operator should work, as it require two condition to be true...even if one is true, the row will not be return...

    actually i was wondering if access 2k2 have any setting or option that actually can cause this kind of error?

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Try this

    SELECT * FROM table1 WHERE Name+Item <>
    'john' +'ball';

  5. #5
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    using the OR operator would mean that EITHER one of the condition is true will return the row.

    Exactly.

    But only one row, but last three rows will evaluate Item<>'ball' to TRUE and you get 3 rows.

  6. #6
    Join Date
    Aug 2003
    Posts
    7
    erm... i think i got what u trying to say... hmm... i will give it a try... thz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •