I have got the following SQL query which I need to rewrite as a web2py
function:
SELECT company.companyname, streetname
FROM company
JOIN address ON company.id=address.company
JOIN companyLOB ON company.id=companyLOB.company
WHERE address.cityname='Eindhoven' AND address.typeofaddress=1 AND
companyLOB.lineofbusiness=1
ORDER BY company.ranking;
The rewritten code:
def byplace():
clubs=db((db.company.id==db.address.company)&(db.company.id==db.companyLOB.company),
\
(db.address.cityName=='Eindhoven')&(db.address.typeOfAddress==1)&(db.companyLOB.lineOfBusiness==1)\
.select(db.company.companyName,db.company.ranking,db.address.streetName,
\
orderby=db.company.ranking|db.company.companyName)
return dict(clubs=SQLTABLE(clubs))
When back in design I click on byPlace I get a SyntaxError:
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py",
line 61, in restricted
else: ccode=compile(code.replace('\r\n','\n'),layer,'exec')
File "/Library/Python/2.5/site-packages/web2py/applications/b2c/
controllers/clubs.py", line 20
return dict(clubs=SQLTABLE(clubs))
^
SyntaxError: invalid syntax
'Eindhoven' is entered for testing purposes, and should be replaced
with an auto-complete field, in which the user types a city name.
I hope one of you can point me in the right direction to solve this
problem.
Best regards,
Annet
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---