dcsimg
Results 1 to 2 of 2

Thread: SELECT with And\OR How to write it?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    3

    SELECT with And\OR How to write it?

    Hi
    I have 2 Querys one with OR and one with AND the OR works as i want but the AND Query don't give any results.
    Please try to help me with this. Attached is the DB table with the data.

    1. OR Query
    SELECT * FROM IDRecords WHERE (IDRecords.FieldID = 0 AND IDRecords.Data = '123456') OR (IDRecords.FieldID = 1 AND IDRecords.Data = 'KATTERMAN,A');


    2. AND Query
    SELECT * FROM IDRecords WHERE (IDRecords.FieldID = 0 AND IDRecords.Data = '123456') AND (IDRecords.FieldID = 1 AND IDRecords.Data = 'KATTERMAN,A');

    Thanks
    Attached Files Attached Files

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,690

    Re: SELECT with And\OR How to write it?

    The and one won't work.... because a field cannot be both 1 AND 0 at the same time... it must be one OR the other.....but it can't be both at the same time.

    Tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width