Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
shapper
Constraint Violating Yak Guru
450 Posts |
Posted - 2012-10-04 : 20:30:52
|
Hello,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,Miguel |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-10-05 : 02:28:35
|
The join condition should have[DateValue]=dateadd(day,datediff(day,0,Created),0)MadhivananFailing to plan is Planning to fail |
|
|
|
|
|