Re: Choosing a value in a query

2005-08-01 Thread Gleb Paharenko
Hello. Maybe this could help. SELECT t1.Users_Code, IF( t1.Affected_Member IS NULL, 'No entry in Table2', IFNULL( t2.Member_Surname, t2.Member_Groupname) ) AS NAME FROM Table1 t1 LEFT JOIN Table2 t2 ON t1.Affected_Member = t2.Member_Code; ++-

Re: Choosing a value in a query

2005-08-01 Thread Dobromir Velev
Hi, You should be able to do a join on both tables and use the IF function in the select. It would look something like select if(Table1.MemberName='', Table2.Member_GroupName, Table1.MemberName) as name from Table1 left join Table2 on ... I cannot guess how your tables are related to each other

Choosing a value in a query

2005-07-31 Thread Martin Lancaster
Hi all, I am using MySQL 4.1.11nt I have two MyISAM tables: Table 1 holds usage information about users accessing various parts of the database. Relevant fields are "Users_Code", "Users_action" and "Affected_Member". Table 2 holds personal information about the Member. Relevant fields are "Membe