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)
 Select Query help

Author  Topic 

nilaavu
Starting Member

18 Posts

Posted - 2006-03-23 : 11:37:04
select inID , InOutID ,clockid from mytable

In the above query i need to return the inID value to be the value of InOutID if clockid= 0
I need
select inID (If clockID = 0 then InId =InOutID) , InOutID ,clockid from mytable
How can I get this in a query?

thx

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-03-23 : 11:53:38
If clockID <> 0
a. do u want to c the current InID or
b. u just don't want to display that record


a.
Select InID = 
Case when ClockID = 0 then InOutID
Else InID
End,
InOutID ,clockid from mytable

b.
Select InOutID as [InID], InOutID, clockid from mytable 
Where clockID = 0
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-24 : 05:34:11
Othrwise post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -