SQL query to retrieve financial year data grouped by the year
Posted
by mlevit
on Stack Overflow
See other posts from Stack Overflow
or by mlevit
Published on 2010-04-07T10:17:52Z
Indexed on
2010/04/07
10:23 UTC
Read the original article
Hit count: 274
Hi,
I have a database with lets assume two columns (service_date & invoice_amount). I would like to create an SQL query that would retrieve and group the data for each financial year (July to June).
I have two years of data so that is two financial years (i.e. 2 results).
I know I can do this manually by creating an SQL query to group by month then run the data through PHP to create the financial year data but I'd rather have an SQL query.
All ideas welcome.
Thanks
© Stack Overflow or respective owner