php - Using MySQL functions in Propel ORM -


i need in writing following raw mysql query in propel orm in "symfony 1.1.9" framework contains mysql functions in select , where.

select date( u.date ) date, time( u.date ) time, u.id account_id, u.user_name ,         if( ( select count( id )         bank         user_id = u.id         , date( creation_date ) > date_add( curdate( ) , interval -30         day )         group user_id ) , 'y', 'n'         ) deposited         user u         date( u.dat ) > date_add( curdate( ) , interval -30         day ) 

i searched lot this. could't relevant solution. tried many possible solution. nothing works. note i'm not prefer use raw query . please help. appreciated. in advance.

the best article have found 1 on page: http://propelorm.org/reference/model-criteria.html#using-a-query-as-input-for-a-second-query-table-su refer section of subqueries.

to started might try following (i haven't tested it's bound have bugs):

$deposited = bankquery::create() ->filterbycreationdate($back30days, criteria::greater) ->groupby('bank.userid');  $users = userquery::create() ->addselectquery($deposited, 'deposited') ->where('deposited.userid = user.id') ->filterbydate($back30days, criteria::greater) ->find(); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -