This may work but you must list explicilty list the two fields else
web2py will try to select the missing id field too.

orglist = db().select
(db.org_chart.code,db.org_chart.empcnt,db.org_chart.empcnt != 2)

On Mar 12, 2:59 am, Yarko Tymciurak <yark...@gmail.com> wrote:
> Try something like this:.....in models/db.py:
> db.define_table('org_chart',   SQLField('name'),
>    SQLField('code', 'integer'),
>    SQLField('empcnt', 'integer'),
>    # migrate=False # if web2py should NOT CREATE or ALTER table
> )
>
> ......in controllers/default.py:
> def index():
>    orglist = db().select(db.org_chart.empcnt != 2)
>    return dict(orglist=orglist)
>
>  ......in views/default/index.html:
> {{extend layout.html}}
> {{=TABLE(*[TR(*emp) for emp in orglist])}}
>
> This should help you get started.
>
> Regards,
> Yarko
>
> On Thu, Mar 12, 2009 at 2:19 AM, shuval <maxshuva...@futcom.ru> wrote:
>
> > I use executesql, but I don't now how work with resulte in form
> > controllers.
> > for example work with procedure
> > test/controllers/default.py
>
> > def index():
> >    return dict(org=db.executesql('select name,code,empcnt from
> > org_chart(100) where empcnt<>2'))
>
> > test/default/index
>
> > org:Max
> >      100
> >      1244
> >      Mike
> >      102
> >      8
> > result in one column
> > There is problem fieldnames procedures and views. How work with result
> > executesql in controller?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to