SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Match Dates and Count
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

450 Posts

Posted - 10/04/2012 :  20:30:52  Show Profile  Reply with Quote

I have two tables:

create table dbo.Dates (
Id int not null
constraint Dates_Id_PK primary key clustered (Id),
[DateValue] date not null

create table dbo.Posts (
Id int identity not null
constraint Posts_Id_PK primary key clustered (Id),
Created datetime not null,
Title nvarchar (200) not null

How can I get a table that has the column DateValue from Dates and the number of Posts with that date.

I need to match the datetime Created value to the date DateValue.

Thank you,


Premature Yak Congratulator

22847 Posts

Posted - 10/05/2012 :  02:28:35  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
The join condition should have



Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000