Solved

SQL Query Needed

Posted on 2011-03-16
1
258 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 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In this article I will describe the Detach & Attach 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.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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