SELECT question

Results 1 to 6 of 6

Thread: SELECT question

  1. #1
    sergio Guest

    Default SELECT question

    When i write the code for opening a recordset with (SELECT * FROM MAIN WHERE ....) how do i make multiple choices for the same field under the WHERE thingy? is writing stuff like ....WHERE myfield = 'sam' or myfield = 'dad' or myfield = ....) is this the only way? or is there something more short and useful?

  2. #2
    Join Date
    Dec 1969

    Default What???

    Multiple choices? what? I don&#039;t understand what you are trying to do...<BR><BR>The where clause limites what the select will return...<BR><BR>-- Whol

  3. #3
    sergio Guest

    Default SELECT question

    yes i know that its the limit but say i want to open all the records with one field equal either to 1 or to 2 or to 9 at the same time. how do i write that down?<BR>

  4. #4
    Eddie Campbell Guest

    Default RE: SELECT question

    "Select * from MyTable Where MyField=1 or MyField=2 or MyField=3"<BR><BR>It&#039;s as simple as that

  5. #5
    sergio Guest

    Default RE: SELECT question

    is this the only way of doing it? actually thats the way i did it, but i didnot think it was the correct way.

  6. #6
    Eddie Campbell Guest

    Default RE: SELECT question

    Well, you could achiev the same like this:<BR><BR>"Select * from MyTable Where MyField in (1,2,3)" <BR><BR>I don&#039;t think there is any performance benefit in either way (and there are undoubtably other ways too), but I could be wrong.

Posting Permissions

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