Solved

SQL with more then 1 value for returning data from a field

Posted on 2007-11-14
3
231 Views
Last Modified: 2012-06-27
I need to return the user id for specific users from a table

such as


select OBjectID,  from PTUsers
where LoginName = 'metatree\jmajorve'
AND LoginName = 'metatree\jkarasek'
0
Comment
Question by:Sanjeet
[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
  • 2
3 Comments
 
LVL 8

Expert Comment

by:digital_thoughts
ID: 20281767
USE DISTINCT
0
 
LVL 8

Accepted Solution

by:
digital_thoughts earned 250 total points
ID: 20281777
Sorry, disregard the first post, you need to use OR

select
      OBjectID
from
      PTUsers
where
      LoginName = 'metatree\jmajorve'
      OR LoginName = 'metatree\jkarasek'
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20281800
select OBjectID  from PTUsers
where LoginName  in (  'metatree\jmajorve' ,  'metatree\jkarasek' )
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

730 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