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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Match Dates

Author  Topic 

bhanu2217
Starting Member

35 Posts

Posted - 2010-05-03 : 08:14:10
[code]
SELECT * FROM enp_news news
join enp_newspaper newsPaper on newsPaper.PaperID=news.PaperID
join be_Posts Post on Post.DateCreated=newsPaper.Date
join enp_newspaperpage paper on paper.PaperID=news.PaperID
where newsPaper.PaperID='1' and paper.PageNo='1'
[/code]

In the above query here

Post.DateCreated=newsPaper.Date

I want to match the dates and not time.
Please help.
Thank You.

www.JamboreeBliss.com

DBA in the making
Aged Yak Warrior

638 Posts

Posted - 2010-05-03 : 08:21:01
CONVERT(VARCHAR, Post.DateCreated, 102) = CONVERT(VARCHAR, newsPaper.Date, 102)


------------------------------------------------------------------------------------
Any and all code contained within this post comes with a 100% money back guarantee.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-03 : 09:42:09
[code]
WHERE Post.DateCreated >= DATEADD(dd,DATEDIFF(dd,0,newsPaper.Date),0)
AND Post.DateCreated < DATEADD(dd,DATEDIFF(dd,0,newsPaper.Date),1)

[/code]

if you want to avoid datatype convertions

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -