|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Subtracting dates
Hello everyone. Simple question. How do you subtract dates? I created the following statement:
Code:
Select Employee_ID, (Clock_Out_Date - Clock_In_Date) days From Employee; This statement works fine but when I try to do something like this: Code:
Select Employee_ID, (Clock_Out_Date - Clock_In_Date) days From Employee Where days > 11; I get a message that it can't find the column and it won't work. What I really want to do though is find the longest date (or max). Anyone have suggestions? |
|
#2
|
|||
|
|||
|
try
Select Employee_ID, (Clock_Out_Date - Clock_In_Date) AS days From Employee |
|
#3
|
||||
|
||||
|
That doesn't really do anything. The "As" is just used to give it an alias. Even then the As is not required.
|
|
#4
|
|||
|
|||
|
Misread the question
Code:
Select Employee_ID, (Clock_Out_Date - Clock_In_Date) days From Employee Where (Clock_Out_Date - Clock_In_Date) > 11; You can't use the Alias in Where, group by or order by S- |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Subtracting dates |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|