Events

Share your cool Custom SQL reports or Lua scripts with other mmex users

Events

Postby Nikolay » Mon Jun 20, 2011 2:25 pm

I have created account "Info" with currency NULL (accound id in that sample is 25)
In that account I put every important events and info with zero amounts. If event is yearly a have marked it as Y in checknumber field.
The report returns yarly events from current date for year.

Code: Select all
Select strftime('%d ',transdate)||m.month_name as "Дата", notes as "Описание" from 
(select * from (select transdate, notes from checkingaccount_v1 c
where accountid=25 and transactionnumber='Y'
and  strftime('%m-%d', transdate)>=strftime('%m-%d','now','localtime')
order by (strftime('%m%d',transdate)))
union all
select * from (select transdate, notes from checkingaccount_v1 c
where accountid=25 and transactionnumber='Y'
and  strftime('%m-%d', transdate)<strftime('%m-%d','now','localtime')
order by (strftime('%m%d',transdate))
) )
left join (select 'январь' as month_name, 1 as month_id union select 'февраль', 2
union select 'март', 3 union select 'апрель', 4
union select 'май', 5 union select 'июнь',6 
union select 'июль',7  union select 'август', 8
union select 'сентябрь', 9  union select 'октябрь', 10
union select 'ноябрь', 11 union select 'декабрь', 12)  m
on m.month_id=round(strftime('%m',transdate))
Nikolay
MMEX Developer
 
Posts: 1173
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia

Return to Custom SQL and Lua Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron