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
 within a month select query

Author  Topic 

kyathj
Starting Member

1 Post

Posted - 2007-04-25 : 01:40:00
elo!

actually im using interbase but id like to know the equivalent SQL code so that i can explore how to do it in interbase.

i have a table with a date field. i would like to select all entries which belong to a certain month. this is how i do it:

"select * from table WHERE (cast(datefield as varchar) like :MNT)"

:MNT is a parameter equivalent to "1/%/2007" for example for january

can you please help me convert this statement to a valid query?

"select * from table where month of datefield in [month]"

i hope you can help me.

thanks in advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-25 : 01:48:13
what database are you using ?
Borland Interbase ?

This is a MS SQL Server forum.


KH

Go to Top of Page

evotin
Starting Member

2 Posts

Posted - 2007-04-25 : 03:22:28
SELECT *
FROM Table
WHERE TO_CHAR(yourDateField, 'MM') = 'jan';
Go to Top of Page
   

- Advertisement -