Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 selecting 2 records ...

Author  Topic 

PGG123
Yak Posting Veteran

55 Posts

Posted - 2004-05-18 : 13:13:38
Here's my resultset, but I want to just get two userIDs: one with the "!" and one from the rest. How should I do this?

txtUserID txtPassword dteExpiryDate
V3IH1R password 2004-11-18 08:29:05.000
U2X557 password 2004-11-18 08:29:05.000
S6Y224 password 2004-11-18 08:29:05.000
RS2ZC4 password 2004-11-18 08:29:05.000
Q0E4L7 password 2004-11-18 08:29:05.000
LS7LQ0 password 2004-11-18 08:29:05.000
LMN45S password 2004-11-18 08:29:05.000
D81KAJ password 2004-11-18 08:29:05.000
577USI password 2004-11-18 08:29:05.000
50A914 password 2004-11-18 08:29:05.000
4SGFX8 password 2004-11-18 08:29:05.000
1J6B0Q password 2004-11-18 08:29:05.000
0P2ASP password 2004-11-18 08:29:05.000
!GB68J password 2004-11-18 08:29:05.000
2004-11-18 08:29:05.000
2004-11-18 08:29:05.000

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-18 : 13:29:31
SELECT TOP 1 txtUserID
FROM Table1
WHERE txtUserID LIKE '%!%'
UNION ALL
SELECT TOP 1 txtUserID
FROM Table1
WHERE txtUserID NOT LIKE '%!%'

Tara
Go to Top of Page
   

- Advertisement -