Solved

SQL Query Needed

Posted on 2011-03-16
1
255 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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

11 Experts available now in Live!

Get 1:1 Help Now