Solved

SQL Query Needed

Posted on 2011-03-16
1
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

729 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