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 |
|
pat22
Starting Member
1 Post |
Posted - 2008-02-11 : 21:08:55
|
hello,I have 1 table called project with 40 records including project_Code, Project_start_date and project_finish_date field.My question is how to find the record who takes long time.If Project_finish_date is NULL he has to appear because the project is not finish.Here is my query but is not working.SELECT code_projectfrom projectwhere datediff(year, date_fin, date_debut)Thank you for your help |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-02-11 : 21:33:19
|
1. you got the datediff parameter wrong. it should be datediff(year, date_debut, date_fin)2. where clause need a logical comparison, the datediff() only returns a valuetryselect *from projectsorder by datediff(year, date_debut, isnull(date_fin, getdate())) desc KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|