Reputation: 143
I wanted to retrieve my data in the database semi-annually. i have a code snippet that i used to retrieve my data quarterly which is:
select Quarter(TransactionDate) as month, count(*) as counted
from service_invoice
where YEAR(TransactionDate) = "2017"
GRoup by Quarter(TransactionDate)
and the output of that query is:
{"quarterly":[{"Quarter":"1","counted":"2"},{"Quarter":"2","counted":"8"},{"Quarter":"3","counted":"6"},{"Quarter":"4","counted":"6"}]}
which is perfectly divided into 4 quarters. now, i want to do the same using semi-annual data. which splits the data into just two types first hale and second half with the output looking like this:
{"semi":[{"half":"1","counted":"2"},{"half":"2","counted":"8"}]}
is there any way i could do that? thanks for your time.
Upvotes: 1
Views: 368