Solved

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

Posted on 2007-11-14
3
202 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
  • 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

757 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

21 Experts available now in Live!

Get 1:1 Help Now