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
 HELP in BETWEEN

Author  Topic 

blindmancries
Starting Member

3 Posts

Posted - 2006-03-20 : 09:33:46
I need help!

I have a db with few records inside.

I want to select only records with ID=6 and that to be between 1.1.2006 and 31.1.2006

How can I formulate query on it.

Best regards,

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2006-03-20 : 09:35:10
Look up WHERE and AND in Books Online..
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-03-20 : 09:36:01
select columns from myTable where id = 6 and yourdateColumn between '20060101' and '20060131'

Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-20 : 09:37:50
If you use variables or columns

select columns from myTable where id = 6 and
yourdateColumn >=dateadd(day,datediff(day,0,date1),0)
and yourdateColumn< dateadd(day,datediff(day,0,date2),1)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-03-20 : 09:41:02
ok i have to ask...
blindmancries, where's "Fed Rep Yugoslavia"??


Go with the flow & have fun! Else fight the flow
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-03-20 : 11:46:22
quote:
Originally posted by spirit1

ok i have to ask...
blindmancries, where's "Fed Rep Yugoslavia"??


Go with the flow & have fun! Else fight the flow



Maybe he means this?


http://en.wikipedia.org/wiki/Socialist_Federal_Republic_of_Yugoslavia
"After Tito's death in 1980, tensions between the various peoples grew, and in 1991 its constituent republics Slovenia, Croatia, Macedonia, and Bosnia and Herzegovina started breaking away. After the initial Yugoslav wars, the process ended in 1992 when the remainder of Yugoslavia, now having only two republics, Serbia and Montenegro, formed the Federal Republic of Yugoslavia, which in 2002 was reformed and renamed to Serbia and Montenegro."



CODO ERGO SUM
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-03-20 : 11:54:50
i know all that... been part of it
could be... that's why i asked.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-03-20 : 12:14:37
quote:
Originally posted by spirit1

i know all that... been part of it
could be... that's why i asked.

Go with the flow & have fun! Else fight the flow


Yes, a very nasty era of conflict. Hopefully, there can be peace in the future.




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -