Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:37:08+00:00 2026-06-15T21:37:08+00:00

Hi i am writing a SQL query for a report which will give the

  • 0

Hi i am writing a SQL query for a report which will give the amounts of leads coming in for the day since 8am. The report is set to go out every our so for example the 8am report will show leads which came in from 7am-8am and the 9am report will show from 7am-9am the 10am from 7am-10am and so on, i would like to know if someone could provide me with the time function to put in the where cluase (something along the lines of:

T.LeadDate >= DATEADD(d, DATEDIFF(d, 0, GETDATE()), 0) -1)

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:37:10+00:00Added an answer on June 15, 2026 at 9:37 pm

    This will get you everything with a LeadDate after 7a.m. of the current day

    select * from TABLENAME t where t.LeadDate >= dateadd(hh,7, DATEDIFF(dd, 0, GETDATE()))
    

    You could also use the following, which seems a little clearer to me.

    select * from TABLENAME t where t.LeadDate >= dateadd(hh,7, CONVERT(datetime,CONVERT(date, getdate())))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an SQL query which will return a list of auctions a
I am writing an SQL query in which that I will need to perform
I am writing an SQL query which involves finding if timestamp falls in particular
I am writing a SQL query which requires highly optimized solution, so as to
I'm writing a SQL query in SQL Server in which I need to replace
I'm writing a SQL query on a timesheet report. I need the report to
I'm writing a SQL query to get a list of parameters for a report
I need help writing an SQL Query which would get me the results as
I'm writing a sql query for an SSRS report and wanted to paramterize the
Im writing sql query and i have issue which i cannot fix. I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.