What does your view look like? Also, this chapter should be helpful: http://web2py.com/books/default/chapter/29/05/the-views
-Jim On Monday, March 9, 2015 at 8:56:38 AM UTC-5, Garry Smith wrote: > > Hi Thanks for the reply, > > I have got query 2 working with the following:- > > qry = request.vars.upn_no > q = (db.pupils.upn_no == qry) > s = db(q) > row = s.select(db.pupils.upn_no,db.pupils.surname) > > which gives me the following. > > pupils.upn_no pupils.surname > > 5555 Dalglish > > Once in the view is their a way off changing column headings and just > showing what you want from the db. > > > > > > > On Monday, 9 March 2015 13:48:17 UTC, Jim S wrote: >> >> thelist=[row.first_name for row in db(db.user.upn == 444).select()] >> >> Have you read chapter 6 from the book? It is well worth your time and >> should help with most of your questions. >> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer >> >> -Jim >> >> >> >> >> >> >> On Monday, March 9, 2015 at 8:31:13 AM UTC-5, Garry Smith wrote: >>> >>> I'm new to web2py, but do have a php and mysql background using >>> codeigniter. >>> I'm trying to write a couple of queries but sure how to do them. >>> These are the queries I'm trying to write, >>> >>> query1 >>> >>> SELECT user.s_name, user.f_name, user.year, pe.date, pe.sport, pe.id >>> FROM user >>> INNER JOIN pe >>> ON user.user_id=pe.user_id >>> WHERE pe.date = DATE(NOW()) >>> ORDER BY user.year" >>> >>> query 2 >>> >>> SELECT user.upn, user.f_name, user.s_name where user.upn = '4444' >>> >>> I tried this on the second query, >>> thelist=[row.first_name for row in db().select(db.pupils.first_name, >>> db.pupils.upn')] >>> >>> which pulls all records, need to know where to put " where upn = '4444'" >>> >>> Thanks in advance. >>> >>> >>> >>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

