
On Sun, 6 May 2012, mark Johnson <mark@chronopia.net> wrote:
Have you tried using a union like:
SELECT type,email FROM lists,aliases WHERE lists.uid='user@example.com' UNION SELECT type,email FROM lists,aliases WHERE aliases.alias='user@example.com' and lists.uid=aliases.uid;
Or (unless I have the wrong join) SELECT type,email FROM lists LEFT JOIN aliases ON lists.uid=aliases.uid WHERE lists.uid='user@example.com' OR aliases.alias='user@example.com';
Thanks for the suggestions. The union works, but I'd prefer to have a join if possible as the SQL statement I provided to the list was a simplified version of the real thing. The real statement is long enough that putting it in twice would be bad for code maintenance. The JOIN that you suggested unfortunately has the performance problem. -- My Main Blog http://etbe.coker.com.au/ My Documents Blog http://doc.coker.com.au/