[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SQL Query Needed

Posted on 2011-03-16
1
Medium Priority
?
269 Views
Last Modified: 2012-05-11
I have the following SQL in my PHP code but it is pulling ALL the items that are "pending or "unassigned" from ALL the offices not just office1... Can someone take a look at it & let me know what I'm doing wrong?



$query="SELECT fid, order, fname, lname, status, oth_date FROM psrinfo WHERE location = 'Office1' AND employee = 'pending' OR  = 'unassigned'";

Open in new window

0
Comment
Question by:wantabe2
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 35148002
both would do:
$query="SELECT fid, order, fname, lname, status, oth_date FROM psrinfo WHERE location = 'Office1' AND employee IN ( 'pending' ,  'unassigned') ";

Open in new window

or
$query="SELECT fid, order, fname, lname, status, oth_date FROM psrinfo WHERE location = 'Office1' AND ( employee = 'pending' OR employee =  'unassigned' ) ";

Open in new window




0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question