How do I select X number of books from table from a criteria with multiple values

Results 1 to 3 of 3

Thread: How do I select X number of books from table from a criteria with multiple values

  1. #1
    Join Date
    Dec 1969
    Posts
    53

    Default How do I select X number of books from table from a criteria with multiple values

    Hi...I want to dynamically select and retrieve the detailed<BR>information of a record of an number of books using the ISBN number which is also one of te fields. Now...i want to be able to select all books with different amount of ISBN nuimbers, sometimes i want 3 books, so i will supply 3 sets of numbers to my query and sometimes i want to retrieve 4. Can i do it with the<BR>execution of one query instead of multiple queries<BR><BR><BR>thanks very much<BR><BR>ramesh

  2. #2
    Shawn Clabough Guest

    Default RE: How do I select X number of books from table from a criteria with multiple values

    You will have to build the query like:<BR><BR>SELECT * FROM Books WHERE ((ISBN = 123456789) OR (ISBN = 987654321) OR ...)<BR><BR>A loop should solve it simply for the number of ISBN&#039s entered.

  3. #3
    Join Date
    Dec 1969
    Posts
    1,671

    Default RE: How do I select X number of books from table from a criteria with multiple values

    You could also use the IN sql function.<BR>Using the line from the previous reply, <BR>SELECT * FROM Books WHERE ISBN IN(123456789,987654321,...)<BR>This is a little easier than multiple ORs if you get a large list of criteria. Simply take in the list of criteria, comma delimit them and stick them in the IN sql function. Note, if they are text fields you will need to wrap them in &#039 marks, i.e. IN(&#039 123456789&#039,&#039 987654321&#039,...)<BR><BR>Mike<BR><BR>

Posting Permissions

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