Date Formats
Posted: Tue Nov 19, 2013 8:27 pm
Hi,
I'm hoping this is a very simple solution, I'm trying to find the type of queries being run on the database over a 10 minutes period, what is wrong with these 2 bits of SQL, both fail with syntax errors:-
select timestampadd(mi,-10,getdate()), request_type, count(*) from QUERY_REQUESTS
where start_timestamp <= 'timestampadd(mi, -10,getdate())' and
start_timestamp >= 'timestampadd (mi, -20,getdate())'
and request_type in ('LOAD','QUERY')
group by request_type
order by request_type;
select timestampadd(mi,-10,getdate()), request_type, count(*) from QUERY_REQUESTS
where start_timestamp between 'getdate() - INTERVAL '10 MINUTES'' and 'getdate() - INTERVAL '20 MINUTES''
and request_type in ('LOAD','QUERY')
group by request_type
order by request_type;
Any help is much appricated.
Regards
Tim
I'm hoping this is a very simple solution, I'm trying to find the type of queries being run on the database over a 10 minutes period, what is wrong with these 2 bits of SQL, both fail with syntax errors:-
select timestampadd(mi,-10,getdate()), request_type, count(*) from QUERY_REQUESTS
where start_timestamp <= 'timestampadd(mi, -10,getdate())' and
start_timestamp >= 'timestampadd (mi, -20,getdate())'
and request_type in ('LOAD','QUERY')
group by request_type
order by request_type;
select timestampadd(mi,-10,getdate()), request_type, count(*) from QUERY_REQUESTS
where start_timestamp between 'getdate() - INTERVAL '10 MINUTES'' and 'getdate() - INTERVAL '20 MINUTES''
and request_type in ('LOAD','QUERY')
group by request_type
order by request_type;
Any help is much appricated.
Regards
Tim