Select Current (Today) Date record from database in SQL Server

sofia
 
on May 31, 2021 06:44 AM
374 Views

hi dharmendr;

sir i run below query to show data on google line chart with last one week data:

the query is here;

SELECT [pingtime],[average] FROM [dbo].[graph] WHERE ipaddress='192.168.15.167' AND CONVERT(DATE,pingtime,103) BETWEEN CONVERT(DATE,DATEADD(DAY, -2, GETDATE()),103) AND CONVERT(DATE,GETDATE(),103) ORDER BY pingtime

question:

my question is if i want to show only current date means today date data how can i modify above query that will show only current date record on google chart.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on May 31, 2021 06:45 AM

Hi sofia,

Refer below query.

SQL

SELECT [pingtime],[average] FROM [dbo].[graph] WHERE ipaddress='192.168.15.167' AND CONVERT(DATE,pingtime,103) = CONVERT(DATE,GETDATE(),103) ORDER BY pingtime