Select Statements for Year

Posts   
 
    
rvanv
User
Posts: 6
Joined: 15-Sep-2005
# Posted on: 07-Nov-2005 22:34:03   

I feel rather lame for asking a question that would seem to have an easy answer, but I have'nt been able to locate any information on how to implement a SQL statement that retrieves records based upon the year of a field date.

Here is the T-SQL that I want to implement:

 select distinct year(EffectiveDate) from tblRateIndices
where year(EffectiveDate) = 2005

Any suggestions, samples, etc.

Thanks.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 08-Nov-2005 02:05:19   

Would this just return 2005? What type of database are you using? Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 08-Nov-2005 10:02:15   

Please see: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3829 for an idea how to implement IExpression for an expression which will emit YEAR(field) Then, create a dynamic list, and add an instance of your IExpression implementation to the ExpressionToUse property of the field in resultsetFields.

Frans Bouma | Lead developer LLBLGen Pro
rvanv
User
Posts: 6
Joined: 15-Sep-2005
# Posted on: 08-Nov-2005 16:28:23   

Otis wrote:

Please see: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3829 for an idea how to implement IExpression for an expression which will emit YEAR(field) Then, create a dynamic list, and add an instance of your IExpression implementation to the ExpressionToUse property of the field in resultsetFields.

Thanks...that really helps. simple_smile