DECLARE @StartTime datetime,@EndTime datetime
SELECT @StartTime=GETDATE()
select distinct born_on.name
from born_on,died_on
where (FLOOR(('2012-01-30'-born_on.DOB)/365.25) <= (
select max(FLOOR((died_on.DOD - born_on.DOB)/365.25))
from died_on, born_on
where (died_on.name=born_on.name))
)
and (born_on.name <> All(select name from died_on))
SELECT @EndTime=GETDATE()
SELECT DATEDIFF(ms,@StartTime,@EndTime) AS [Duration in millisecs]
I am unable to get the query time. Instead I get the following error:
sql:/home/an/Desktop/dbms/query.sql:9: ERROR: syntax error at or near "@"
LINE 1: DECLARE @StartTime datetime,@EndTime datetime