Sorry, round has two parameters. Put a 0 as parameter 2.

Blair

On 5/17/06, Blair McKenzie <[EMAIL PROTECTED] > wrote:
This is valid transact sql. You might need to put it in a stored procedure to use it.
round((month(date_field)+2)/14)+year(date_field) as financial_year
This should return the correct year for jan-jun, and year+1 for jul-dec. I don't know how financial years are usually labeled, but if you want to use the year they start instead just subtract 1.

Blair


On 5/17/06, KNOTT, Brian < [EMAIL PROTECTED]> wrote:

That only works if you know what financial year you are operating in.  I want to return all data in a query starting with the first available financial year.

 


From: cfaussie@googlegroups.com [mailto: cfaussie@googlegroups.com] On Behalf Of Dale Fraser
Sent: Wednesday, 17 May 2006 3:04 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Re: Dates

 

WTF?

 

Dates are only ordered one of two ways, ascending or decending.

 

So if you do something like

 

Select      *

From        TableName

Where       DateFiled between '2005-07-01' and '2006-06-30'

Order By    DateField

 

That will do the trick, but it's not ordering it's the Where bit your after.

Regards
Dale Fraser


From: cfaussie@googlegroups.com [mailto: cfaussie@googlegroups.com] On Behalf Of KNOTT, Brian
Sent: Wednesday, 17 May 2006 14:50 PM
To: cfaussie@googlegroups.com
Subject: [cfaussie] Dates

 

How can I get SQL to order dates by financial year not calendar year.  I want to order a query from1/72005 to 30/06/2006.

 

Brian Knott

-----------------------------------------------------------------------------------

This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its related entities "Suncorp".

Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 13 11 55 or at suncorp.com.au.

The content of this e-mail is the view of the sender or stated author and does not necessarily reflect the view of Suncorp. The content, including attachments, is a confidential communication between Suncorp and the intended recipient. If you are not the intended recipient, any use, interference with, disclosure or copying of this e-mail, including attachments, is unauthorised and expressly prohibited. If you have received this e-mail in error please contact the sender immediately and delete the e-mail and any attachments from your system.

If this e-mail constitutes a commercial message of a type that you no longer wish to receive please reply to this e-mail by typing Unsubscribe in the subject line.

 










--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to