locked
Double SQL criteria RRS feed

  • Question

  • User-117747970 posted

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Reservation</title>

    <tfoot></tfoot>
    Reservation
    reservationID reservationDate reservationOutlet destinationOutlet itemName itemColor itemSize itemQuantity custName custContact custEmail reservationStatus deliveryStatus collectionStatus specialInstructions
    1 1/1/2009 Utah Alabama 2165-6188 Harbor Blue S 1 John F. Valeri 23784623 john@valeri.com Pending Pending Pending
    2 2/1/2009 Illinois Michigan 1165-6228 Fresh Water M 2 Elizabeth MountBerry 32937473 eliz@hotmail.com Completed Self Collection Completed
    3 3/1/2009 Washington Washington 1192-9008 Chalk M 1 Christopher Ignatious Barley 47533843 christ@yahoo.com Completed Completed Completed
    4 4/1/2009 Washington Connecticut 0103-9150 Khaki S 1 Shirgin Ang 98487523 shirg@shirgin.com Completed Pending Pending
    5 9/1/2009 Utah Florida 2165-6188 Blood Pink XL 1 Jervine Maryland 47573234 jer@hotmail.com.uk Completed Pending Completed
    6 9/1/2009 Texas Florida 1192-9008 Chalk L 2 Mark May 23492384 mark.m@yahoo.co.uk Pending Pending Pending
    7 10/1/2009 North Caroline Florida 1192-9008 Chalk M 1 Nathan Chandler 04959234 nate@hotmail.com Completed Completed Pending

     

     How may I extract only information for say ONLY destinationOutlet="Florida" where EITHER the CollectionStatus and/or reservationStatus is "Pending"

     

    This is not working:

    1    select * from Reservation WHERE destinationOutlet='Florida' and reservationStatus='Pending' or collectionStatus='Pending'
    
      
    Saturday, January 24, 2009 9:52 AM

Answers

  • User-117747970 posted

    Hi Junjie1800,

    Try this and let me know,

     

    SELECT * FROM Reservation 
    WHERE (((destinationOutlet)='Florida') AND ((reservationStatus)='Pending') OR (((collectionStatus)='Pending'));
    
     Leo.

     

     

    Thanks Leo, your statement didn't work the way I wanted to but you had suggested putting them in brackets so after a few tries, I've got it: Thanks again.

     

    SELECT * FROM Reservation WHERE (((reservationStatus='Pending') OR (collectionStatus='Pending')) AND (destinationOutlet='Florida'))
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 25, 2009 3:43 AM

All replies

  • User-663234556 posted

    Hi Junjie1800,

    Try this and let me know,

     

    SELECT * FROM Reservation 
    WHERE (((destinationOutlet)='Florida') AND ((reservationStatus)='Pending') OR (((collectionStatus)='Pending'));
    
     Leo.
    Saturday, January 24, 2009 11:06 AM
  • User-117747970 posted

    Hi Junjie1800,

    Try this and let me know,

     

    SELECT * FROM Reservation 
    WHERE (((destinationOutlet)='Florida') AND ((reservationStatus)='Pending') OR (((collectionStatus)='Pending'));
    
     Leo.

     

     

    Thanks Leo, your statement didn't work the way I wanted to but you had suggested putting them in brackets so after a few tries, I've got it: Thanks again.

     

    SELECT * FROM Reservation WHERE (((reservationStatus='Pending') OR (collectionStatus='Pending')) AND (destinationOutlet='Florida'))
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 25, 2009 3:43 AM