user1532468 user1532468 - 3 months ago 6
MySQL Question

Retrieve more than 1 mysql column using AND statement

I am using mysql and what I am tryng to achieve, is to select more than 1 column in a select statement. From the sample code I have posted, I can retrieve the value 'Box Retrieval' in the activity column. However, what I would like to do, is select the values, 'Box Retrieval' 'Box Return, etc, Is this possible. Thanks

$query = "SELECT * FROM act WHERE company = '".$_SESSION['kt_idcode_usr']."' AND activity = 'Box Retrieval' ORDER BY date DESC";

Answer

Try this might be helpful for you.

$query = "SELECT * FROM act WHERE activity IN ('Box Return', 'Box Retrieval', 'Box Destruction') AND company = '".$_SESSION['kt_idcode_usr']."' ORDER BY date DESC";