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 |
|
Weekend
Starting Member
20 Posts |
Posted - 2007-08-22 : 02:25:50
|
| HiSQL Server 2000I have four columns of date in a table say Date1, Date2, Date3, Date4 in table Tab_A.I want to get average date of four columns for each row.Please advise how?ThanksJ a w a d |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-08-22 : 02:59:00
|
Something similar to thisSELECT Date1, Date2, Date3, Date4, ( SELECT DATEADD(HOUR, AVG(p), 0) FROM(SELECT DATEDIFF(HOUR, 0, Date1) AS p UNION ALL SELECT DATEDIFF(HOUR, 0, Date2) UNION ALL SELECT DATEDIFF(HOUR, 0, Date3) UNION ALL SELECT DATEDIFF(HOUR, 0, Date4)) AS d)FROM Tab_A E 12°55'05.25"N 56°04'39.16" |
 |
|
|
Weekend
Starting Member
20 Posts |
Posted - 2007-08-22 : 03:19:28
|
| Dear PesoThanks you very much.Your solution work well for me.ThanksJ a w a d |
 |
|
|
|
|
|
|
|