Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
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 needselect 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 recorda.
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
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2006-03-24 : 05:34:11
Othrwise post some sample data and the result you wantMadhivananFailing to plan is Planning to fail