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.
| Author |
Topic |
|
d473566
Starting Member
23 Posts |
Posted - 2005-11-13 : 22:39:10
|
| I have a query that returns a recordset such as:ID | FromDate1 | FromDate2 | FromDate322 | 01/01/2003 | 01/01/2002 | 01/01/2004 | 23 | 01/01/1997 | 01/01/1991 | 01/01/1992 | 24 | 01/01/1984 | 01/01/1981 | 01/01/1982 | 25 | 01/01/1974 | 01/01/1976 | 01/01/1972 | I need to add another column to my recordset that will hold the minumum date from the 3 columns in each row. The result would look something like:ID | FromDate1 | FromDate2 | FromDate3 | MinDate22 | 01/01/2003 | 01/01/2002 | 01/01/2004 | 01/01/200223 | 01/01/1997 | 01/01/1991 | 01/01/1992 | 01/01/199124 | 01/01/1984 | 01/01/1981 | 01/01/1982 | 01/01/198125 | 01/01/1974 | 01/01/1976 | 01/01/1972 | 01/01/1972Thanks to all for any direction....Derek |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2005-11-13 : 23:37:15
|
| Somthing like this .. Select ID,FromDate1,FromDate2,Fromdate3,Case When FromDate1>FromDate2 And FromDate1 > FromDate3 Then FromDate1 When FromDate2>FromDate1 And FromDate2>FromDate3 Then FromDate2 ElseFromDate3EndFrom <TableName>Complicated things can be done by simple thinking |
 |
|
|
|
|
|