• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

SQL Query Help - Date Time Query

Team,

I have a column "ReportTimeStamp" in a table which is "smalldatetime" datatype.

Data inside those columns will be like this, " 2011-05-02 01:01:00 "

I need to write a query where ReportTimeStamp in (5/2/2011) & so on. I am currently unable to do the same.

Example query am using:
select agingbucket, count(*) as 'Mon' from
(select a.ReportTimeStamp, a.Team, a.Manager, a.SR_Owner, a.[Group], a.SR_ID_No, a.SR_Type,
a.Severity, a.Days_Open, b.Agingbucket, b.orderoption from
(select cast(ReportTimeStamp as datetime) as ReportTimeStamp,
Team, Manager, SR_Owner, [Group], SR_ID_No, SR_Type, Severity, Days_Open from backlograw
Where Team in (@Team) and Reporttimestamp in
(SELECT (CAST(MONTH(getdate() -  datepart(dw, getdate()) + 2)
AS varchar(2)) + '/' + CAST(DAY(getdate() -  datepart(dw, getdate()) + 2) AS varchar(2)) + '/' +
CAST(YEAR(getdate() -  datepart(dw, getdate()) + 2) AS varchar(4))) Mon)) a
Inner Join
(select [Difference], AgingBucket, orderoption from FlexAgingBucket) b
on a.Days_Open = b.[Difference]) a
group by agingbucket

Its throwing no result at all. pls help
0
davidi1
Asked:
davidi1
1 Solution
 
knightEknightCommented:
What date range are you looking for?  Plus or minus 2 days from the current date?
0
 
davidi1Author Commented:
nevermind. i got it..,
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now