Results 1 to 2 of 2
  1. #1
    johnbest is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2012
    Posts
    9

    select particular records only

    Hi there,

    I am new to sql and below is my table structure-

    cid name
    1 A
    2 A
    2 B
    3 A
    3 B
    3 C
    4 A
    5 A
    5 C
    6 A

    I want only those records where name is A or C and not B

    I mean the output will be -

    cid name
    1 A
    4 A
    5 A
    5 C
    6 A

    thanks in adv
    John
    Last edited by johnbest; 12-06-2013 at 02:02 AM. Reason: output

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,630
    Try:

    SELECT * FROM tablename WHERE cid Not In (SELECT cid FROM tablename WHERE [name] = "B");

    Review this thread with similar requirement https://www.accessforums.net/queries...ues-39846.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query to Select Records and Alphabetize them
    By MarcieFess in forum Queries
    Replies: 2
    Last Post: 10-24-2013, 09:34 AM
  2. Replies: 2
    Last Post: 05-28-2013, 04:00 PM
  3. Replies: 3
    Last Post: 01-04-2011, 07:06 PM
  4. How to use a subform to select and use records
    By shiphtfour in forum Forms
    Replies: 3
    Last Post: 01-02-2011, 01:04 PM
  5. select records in recordset
    By sksriharsha in forum Programming
    Replies: 3
    Last Post: 09-05-2009, 11:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums