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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to select first records for cuurent month

Author  Topic 

attman
Starting Member

16 Posts

Posted - 2009-12-27 : 20:34:21
my query
where id in(select min(ID) from records where serino='00904041' and tarih>=convert(varchar,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)) and tarih<convert(varchar,DATEADD(mm, DATEDIFF(mm,0,getdate()), 0))

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-12-27 : 20:55:03
[code]
where serino = '00904041'
and tarih >= dateadd(month, datediff(month, 0, getdate()), 0)
and tarih < dateadd(month, datediff(month, 0, getdate()) + 1, 0)
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

attman
Starting Member

16 Posts

Posted - 2009-12-28 : 22:08:28
thanks
Go to Top of Page
   

- Advertisement -