[Zope-DB] Trouble writing a left join using z sql method
Laura McCord
Laura.McCord at doucet-austin.com
Thu Apr 29 11:44:30 EDT 2004
hi,
I am trying to write a Z SQL Method to do the following:
select userid, username, useremail, useroffice, userpwd, userpwdchg, pcTable.pcname, pcmake, pcmodel , pcserial, pcmhz, pcmbram, pc_oem_os, pc_oem_os_key, pc_ip_add from users left join pcTable on users.pcname = pcTable.pcname where userid = 1 (userid passed from link)
Basically, I want everything from the users table and pcTable where the userid is equla to what is passed. The tables are linked on the users.pcname = pcTable.pcname
Now I am not sure how to do this with a left join but this is what I have so far and when I test it it states that it could not render:
select
'<dtml-var name="userid" sql_quote>',
'<dtml-var name="username" sql_quote>',
'<dtml-var name="useremail" sql_quote>',
'<dtml-var name="useroffice" sql_quote>',
'<dtml-var name="userpwd" sql_quote>',
'<dtml-var name="userpwdchg" sql_quote>',
'<dtml-var name="pcTable.pcname" sql_quote>',
'<dtml-var name="pcmake" sql_quote>',
'<dtml-var name="pcmodel" sql_quote>',
'<dtml-var name="pcserial" sql_quote>',
'<dtml-var name="pcmhz" sql_quote>',
'<dtml-var name="pcmbram" sql_quote>',
'<dtml-var name="pc_oem_os" sql_quote>',
'<dtml-var name="pc_oem_os_key" sql_quote>',
'<dtml-var name="pc_ip_add" sql_quote>'
from users left join pcTable on
users.pcname = pcTable.pcname
where
userid = <dtml-var name="userid" sql_quote>
Thanks,
Laura
More information about the Zope-DB
mailing list