| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
Senior Member
Join Date: Jan 2005
Posts: 12,340
|
help with mysql query
Nevermind. I got it: SELECT cms_module_feusers_belongs.groupid, cms_module_feusers_properties.data FROM cms_module_feusers_belongs, cms_module_feusers_properties WHERE cms_module_feusers_belongs.userid = cms_module_feusers_properties.userid AND cms_module_feusers_properties.title = 'emailaddress' AND cms_module_feusers_belongs.groupid = '$groupid' Last edited by pgo : 02-05-2007 at 12:22. |
|
|
|
|
|
#2 (permalink) |
|
chromophile
Join Date: May 2007
Location: Somewhere in Europe
Posts: 7
|
A tip. Using aliases makes things easier to read... and therefore easier to write and debug I'd write SELECT belongs.groupid, properties.data FROM cms_module_feusers_belongs belongs, cms_module_feusers_properties properties WHERE belongs.userid = properties.userid AND properties.title = 'emailaddress' AND belongs.groupid = '$groupid' but if you like long names... thats your call. I write code this way SELECT b.groupid, p.data FROM cms_module_feusers_belongs b, cms_module_feusers_properties p WHERE b.userid = p.userid AND p.title = 'emailaddress' AND b.groupid = '$groupid' arguably this last is a bit cryptic, but its less to type, but easy to think about as b and p are mnemonic. I'm a lazy sod though and that might be why I like it. |
|
![]() |