Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Statement

Status
Not open for further replies.

nerram

Programmer
Apr 23, 2003
56
IE
Example Table:
Username Status StatusB
-------------------------------
joe O
kevin O V
peter R V
mary O
Fred R

I want to select all usernames where the status is equal to O and Status B is not equal to V. I bit confuse with how to do this.
 
hi, i think you should try;

Select Username
From (TableName)
WHERE Status="O"
AND StatusB NOT "V"

Hope it helps
 
That gives me a syntax error around the NOT, should it??
 
Select Username
From (TableName)
WHERE Status="O"
AND NOT T.LStatus ="V"

This returns Paula but nothing else any reasons??
Example Table:

Username Status StatusB
-------------------------------
joe O
kevin O V
peter R V
mary O
Fred R
Paula O L
 
Code:
Select Username
From TableName 
WHERE Status= 'O'
AND ( LStatus <> 'V' or Lstatus is null)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top