Solved

SQL Query Needed

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

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Merge Statement 3 39
How can I exclude some wording in a like statement? 39 64
SQL profiler equivalent in MS-Access 3 41
SQL Server merge records in one table 2 10
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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 remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

929 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now